jQuery now() Method

Beginner
5 min read
Updated: Oct 2026
5 examples
Live preview

What Is jQuery.now()?

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().

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

// Example shape (value changes every call):
$.now()  → 1728000000123
NeedUse
Current epoch ms (modern)Date.now()
Timestamp from a Date objectdate.getTime()
Legacy jQuery only$.now() (1.4.3–3.x)

How to Use jQuery.now()

Call it with no arguments; store or subtract the Number you get.

  1. Call $.now() (or prefer Date.now()).
  2. Use the Number for timing, IDs, or query strings.
  3. For elapsed time: end - start (both from now).
  4. In new code, write Date.now() instead of $.now().
PieceRequired?Role
ArgumentsNoneMethod takes no parameters
Return—Number — epoch milliseconds
Since—jQuery 1.4.3

Pseudocode

Pseudocode
now():
    return milliseconds since Unix epoch

// Official meaning:
jQuery.now  ≡  Date.now

// Elapsed pattern:
start = now()
do work
elapsed = now() - start

Cheat Sheet

Keep these facts handy when reading legacy jQuery timing code.

TopicDetail
AccessjQuery.now() / $.now()
ReturnsEpoch ms (Number)
AliasDate.now()
DeprecatedjQuery 3.3+
RemovedjQuery 4.0
Modern replaceDate.now()

Live Preview

Run $.now(), compare with Date.now(), or build a cache-bust URL.

Browser demo of $.now() — prefer Date.now() in new code.

Result
Click “Run now” to read the current timestamp.

jQuery Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

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.
  4. Fresh. Each call reads “now” again — values differ over time.

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.
  4. Migrate. Prefer writing Date.now() only.

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.
  4. Diff. end - start is elapsed milliseconds.

Example 4 — Cache-Bust Query String

Append a changing timestamp so browsers treat the URL as fresh.

jQuery
var url = "/js/widget.js?v=" + $.now();
console.log(url);
// e.g. /js/widget.js?v=1728000000123
Try It Yourself

How It Works

  1. Base URL. Start with the asset path.
  2. Stamp. Concatenate $.now() as v.
  3. Unique. Each load gets a new query string.
  4. Modern. Same pattern with Date.now().

Example 5 — Temporary Unique ID

Build a one-off element id with a timestamp suffix.

jQuery
var tempId = "panel-" + $.now();
$("<div></div>")
  .attr("id", tempId)
  .text("Hello from " + tempId)
  .appendTo("#log");
Try It Yourself

How It Works

  1. Build id. Prefix + $.now() makes a unique string.
  2. Create. Make a div and set that id.
  3. Show. Put the id in the text so you can see it.
  4. Caveat. Two calls in the same ms can collide — fine for demos, not crypto IDs.

Edge Cases & Pitfalls

Check these before relying on $.now() in production.

deprecated

Gone in jQuery 4.0

Calling $.now() on jQuery 4+ throws. Migrate to Date.now() before upgrading.

clock

System clock can jump

Epoch time follows the OS clock. NTP adjustments can make elapsed diffs look odd. For short UI timing, performance.now() is steadier.

ids

Not a unique-ID guarantee

Two calls in the same millisecond can match. Fine for demos; use a counter or crypto.randomUUID() when uniqueness matters.

precision

Millisecond resolution only

$.now() / Date.now() are whole milliseconds. Micro-benchmarks need performance.now().

Browser Support

jQuery.now() needs jQuery 1.4.3–3.x loaded. It is removed in jQuery 4.0. Prefer Date.now() in every modern browser.

✓ jQuery 1.4.3–3.x · Deprecated

jQuery.now()

Works in Chrome, Firefox, Safari, and Edge when jQuery 1.4.3–3.x is loaded. New projects should call Date.now() instead.

Legacy Use Date.now()
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
$.now Deprecated

Bottom line: Replace $.now() with Date.now() — same Number, no jQuery dependency.

Performance Notes

ApproachCostBest for
Date.now()O(1), nativeAll new code
$.now()O(1), aliasLegacy jQuery 1.4.3–3.x
new Date().getTime()Allocates DateWhen you already need a Date
performance.now()High-res, relativePrecise duration in the page

Prefer Date.now() for clarity and future-proofing. The cost difference vs $.now() is negligible; the API status is what matters.

Key Takeaways

  • Role: $.now() returns epoch milliseconds.
  • Alias: same idea as Date.now().
  • Migrate: replace with Date.now() (gone in jQuery 4).
  • Elapsed: end - start both from now.

One line: $.now() is a deprecated alias for Date.now() — use the native method in new code.

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: jQuery.parseJSON()

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

parseJSON() →

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