jQuery now() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Utilities

Definition

jQuery.now() (alias $.now()) returns the current time as milliseconds since the Unix epoch (since jQuery 1.4.3). Official docs: it is an alias for Date.now().

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$.now()      → Number  (ms since 1970-01-01 UTC)
Date.now()   → same idea (prefer this)

// Example shape (value changes every call):
$.now()  → 1728000000123
CallWhat it does
ArgumentsMethod takes no parameters
ReturnNumber — epoch milliseconds
SincejQuery 1.4.3

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Call $.now() (or prefer Date.now()).
Step 2Use the Number for timing, IDs, or query strings.
Step 3For elapsed time: end - start (both from now).

Return Value

Return ValueDescription
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Current Timestamp

Read the epoch milliseconds and confirm the type.

jQuery
var timestamp = $.now();

console.log(typeof timestamp); // "number"
console.log(timestamp);        // e.g. 1728000000123
Try It Yourself

How It Works

  1. Call. $.now() needs no arguments.
  2. Type. Result is always a number.
  3. Meaning. Milliseconds since 1970-01-01 UTC.

Example 2 — $.now vs Date.now

Official idea: $.now() is an alias for Date.now().

jQuery
console.log($.now === Date.now); // true in modern jQuery

var a = $.now();
var b = Date.now();
console.log(typeof a === "number");
console.log(Math.abs(a - b) <= 1); // same clock, within 1 ms
Try It Yourself

How It Works

  1. Same fn. Modern jQuery often sets $.now to Date.now.
  2. Same unit. Both return epoch milliseconds.
  3. Close values. Two calls a tick apart can differ by 0–1 ms.

Example 3 — Measure Elapsed Time

Subtract start from end to get duration in milliseconds.

jQuery
var start = $.now();
for (var i = 0; i < 500000; i++) { /* work */ }
var elapsed = $.now() - start;

console.log("Elapsed: " + elapsed + " ms");
Try It Yourself

How It Works

  1. Start. Capture a stamp before the work.
  2. Work. Run the loop (or any code).
  3. End. Capture a second stamp.

Frequently Asked Questions

jQuery.now() returns a Number: milliseconds since the Unix epoch (1 Jan 1970 UTC). It takes no arguments. Officially it is an alias for Date.now().
Yes. Deprecated in jQuery 3.3 and removed in jQuery 4.0. Prefer native Date.now() in all new code. On jQuery 1.4.3–3.x, $.now() still works for legacy maintenance.
Same millisecond timestamp. $.now() was a convenience next to other jQuery utilities. In modern jQuery builds, $.now is typically the Date.now function itself. Always migrate to Date.now().
All three give epoch milliseconds for “now.” Date.now() / $.now() avoid creating a Date object. new Date().getTime() allocates a Date first — same numeric idea, slightly more work.
For rough elapsed checks, yes: end - start. For high-resolution timing, prefer performance.now() — sub-millisecond precision relative to page load, not the Unix epoch.
Replace every $.now() call with Date.now(). Behavior matches: same Number, no arguments, same epoch meaning.

Next: parseJSON() Method

Parse JSON strings — and learn why JSON.parse is preferred today.

parseJSON() Method tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful