The jQuery.now() utility returns the current time as a millisecond timestamp — the same value as native Date.now(). This tutorial covers syntax, timing patterns, comparisons with other date APIs, practical cache-busting and ID generation, and migration notes for jQuery 3.3+.
01
Syntax
$.now()
02
Number
Ms since epoch
03
No args
Zero parameters
04
Date.now
Native alias
05
Timing
Elapsed checks
06
Deprecated
Removed in jQuery 4
Fundamentals
Introduction
Timestamps appear everywhere in web development: measuring how long an animation takes, busting browser caches on script URLs, stamping log entries, or generating temporary IDs. jQuery added jQuery.now() (also written $.now()) in version 1.4.3 as a shorthand for getting the current time without leaving the jQuery namespace.
Under the hood, $.now() is an alias for Date.now() — the native JavaScript method that returns milliseconds since January 1, 1970 UTC. jQuery deprecated the helper in version 3.3 and removed it in 4.0. Modern code should call Date.now() directly.
Concept
Understanding the jQuery.now() Method
jQuery.now() takes no arguments and returns a Number — the number of milliseconds that have elapsed since the Unix epoch. Each call produces a fresh value reflecting the moment the function runs.
The result is not a formatted date string and not a Date object. It is a plain number like 1721289600123, ideal for arithmetic: subtract a start timestamp from an end timestamp to get elapsed milliseconds.
💡
Beginner Tip
Think of $.now() as a stopwatch reading in milliseconds since 1970. To measure duration: var ms = $.now() - start;
Foundation
📝 Syntax
General form of jQuery.now:
jQuery
jQuery.now()
// or
$.now()
Parameters
None — this method does not accept any arguments.
Return value
A Number representing the current time in milliseconds since the Unix epoch (January 1, 1970 UTC).
Official jQuery API description
jQuery
var timestamp = $.now();
// Same value as Date.now()
// e.g. 1721289600123
Cheat Sheet
⚡ Quick Reference
Goal
Code
Current timestamp (jQuery)
$.now()
Current timestamp (native)
Date.now()
Elapsed milliseconds
$.now() - start
Cache-bust a URL
"app.js?v=" + $.now()
Unique ID suffix
"id-" + $.now()
Status in jQuery 4+
Removed — use Date.now()
Compare
📋 $.now vs Date.now vs performance.now
Three ways to read time — different purposes and return values.
$.now
epoch ms
jQuery 1.4.3+; deprecated 3.3
Date.now
epoch ms
ES5+; standard replacement
getTime()
new Date()
Creates Date object first
perf.now
high-res
Relative to page load; sub-ms
Hands-On
Examples Gallery
Each example uses $.now(). Open DevTools or use the Try-it links. Example 1 shows the basic timestamp the jQuery API describes.
📚 Getting Started
Read the current millisecond timestamp.
Example 1 — Get the Current Timestamp
Call $.now() to receive a number representing the current time — the core behavior documented in the jQuery API.
jQuery
var timestamp = $.now();
console.log(typeof timestamp); // "number"
console.log(timestamp > 0); // true — always positive since 1970
jQuery delegates to the browser’s clock and returns epoch milliseconds as a plain number. The exact value changes every millisecond — log it in DevTools to see a 13-digit integer.
📈 Practical Patterns
Alias check, timing, cache busting, and ID generation.
Example 2 — Same Value as Date.now()
Confirm that $.now() is an alias — both calls return the same millisecond timestamp.
jQuery
var jqueryTime = $.now();
var nativeTime = Date.now();
console.log(jqueryTime === nativeTime); // true (same millisecond)
When you call both in the same synchronous tick, they read the same clock and produce identical numbers. That is why migrating $.now() to Date.now() is a safe one-line replacement.
Example 3 — Measure Elapsed Milliseconds
Subtract a start timestamp from the current time to see how long an operation took.
jQuery
var start = $.now();
// Simulate work
for (var i = 0; i < 100000; i++) { /* loop */ }
var elapsed = $.now() - start;
console.log("Took " + elapsed + " ms");
Took 0 ms
(or a small positive number depending on device)
How It Works
Because both values are epoch milliseconds, subtraction gives duration in milliseconds. For sub-millisecond precision in modern browsers, use performance.now() instead — but for coarse AJAX or animation timing, $.now() was sufficient.
Example 4 — Cache-Bust a Script URL
Append a timestamp query parameter so browsers fetch a fresh copy instead of a cached file.
jQuery
var scriptUrl = "/js/widget.js?v=" + $.now();
console.log(scriptUrl);
// "/js/widget.js?v=1721289600123"
/js/widget.js?v=1721289600123
(actual number varies per call)
How It Works
Each page load gets a unique v= value, so the URL differs from cached versions. jQuery’s own dynamic script loading historically used similar timestamp tricks before modern cache headers and module bundlers.
Example 5 — Generate a Temporary Unique ID
Prefix a timestamp to create a quick DOM element ID or request token.
panel-1721289600123
(actual number varies per call)
How It Works
Millisecond timestamps are unique enough for short-lived UI elements in the same session. For cryptographically secure IDs, use crypto.randomUUID() instead — but timestamp suffixes were a common jQuery-era pattern.
Applications
🚀 Common Use Cases
Elapsed timing — measure AJAX round-trips or animation duration.
Cache busting — append ?v=timestamp to script or CSS URLs.
Unique IDs — stamp dynamically created DOM nodes or plugin instances.
Debounce / throttle — compare last-run timestamps on scroll or resize handlers.
Logging — record when events fired in legacy debugging code.
Rate limiting — reject requests that arrive too soon after the previous one.
🧠 How jQuery.now() Returns a Timestamp
1
Call $.now()
No arguments — jQuery invokes the internal time helper.
Invoke
2
Delegate to Date.now
jQuery forwards to the native Date.now() implementation.
Native
3
Read system clock
Browser returns milliseconds since January 1, 1970 UTC.
Clock
4
⏱
Return Number
Use the value for subtraction, URL params, or ID suffixes.
Important
📝 Notes
Available since jQuery 1.4.3; deprecated in jQuery 3.3; removed in jQuery 4.0.
Alias for Date.now() — not for new Date() or formatted date strings.
Returns epoch milliseconds, not seconds — divide by 1000 only when you need Unix seconds.
For high-resolution relative timing, use performance.now() (different origin and precision).
System clock changes (NTP adjustments) can affect elapsed-time math over long intervals.
Replace $.now() with Date.now() when upgrading to jQuery 4.
Compatibility
Browser Support
jQuery.now() was a jQuery utility since 1.4.3+. Native Date.now() is the recommended replacement — supported in all modern browsers since ES5 (2009) and in Node.js.
✓ Deprecated · jQuery 3.3
jQuery jQuery.now()
Works in jQuery 1.x–3.x. Deprecated in 3.3 and removed in 4.0. Native Date.now() is supported in Chrome 1+, Firefox 3.5+, Safari 5+, Edge, IE 9+, and all current runtimes.
100%Native Date.now() support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
Date.now()Universal
Bottom line: Learn $.now() to read legacy jQuery timing code, but write Date.now() in new projects. Plan a find-and-replace migration before moving to jQuery 4.
Wrap Up
Conclusion
The jQuery.now() utility returns the current time as a millisecond timestamp — identical to Date.now(). It was a small convenience for jQuery-centric codebases that needed timing, cache busting, or unique suffixes without switching namespaces.
For modern development, call Date.now() directly. The behavior is the same, with no dependency on a deprecated jQuery API removed in version 4.0.
Subtract timestamps to measure elapsed milliseconds
Replace $.now() when upgrading to jQuery 4
Use performance.now() for sub-ms benchmarks
Pair with debounce/throttle for scroll and resize handlers
❌ Don’t
Expect a formatted date string from $.now()
Confuse epoch ms with Unix seconds — divide by 1000 if needed
Use $.now() in greenfield apps when jQuery is not required
Rely on timestamps alone for secure unique tokens
Forget deprecation — plan migration off $.now()
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about jQuery.now()
Epoch milliseconds on demand.
5
Core concepts
⏱01
$.now()
Current time
API
🔢02
Number
Epoch ms
Return
🔗03
Date.now
Native alias
Replace
⚠04
Deprecated
Removed in 4.0
jQuery 3.3+
📈05
Timing
Subtract start
Pattern
❓ Frequently Asked Questions
jQuery.now() returns a number representing the current time — specifically, milliseconds elapsed since the Unix epoch (January 1, 1970 UTC). It accepts no arguments and is a thin alias for the native Date.now() method.
A Number — the same millisecond timestamp you get from Date.now(). For example, 1721289600123. The value changes every time you call it and is useful for timing, unique IDs, and cache-busting query strings.
They return the same type of value. jQuery.now() was a convenience wrapper so developers could write $.now() alongside other jQuery utilities. jQuery deprecated $.now() in version 3.3 and removed it in 4.0 — use Date.now() directly in modern code.
Both return millisecond timestamps since the epoch. Date.now() is shorter and avoids creating a Date object. new Date().getTime() allocates a Date instance first — slightly more overhead, same numeric result for current time.
No. Use Date.now() in all new JavaScript. jQuery removed $.now in version 4.0. When upgrading legacy code, replace $.now() with Date.now() — a one-to-one swap with identical behavior.
For rough elapsed-time checks in legacy jQuery code, yes: var start = $.now(); ... var ms = $.now() - start. For high-precision micro-benchmarks, prefer performance.now() — it returns milliseconds with sub-millisecond precision but is relative to page load, not the Unix epoch.
Did you know?
Before ES5, getting epoch milliseconds required new Date().getTime() — creating a Date object every time. ES5 added Date.now() as a static shortcut, and jQuery’s $.now() wrapped that same call so plugin authors could stay inside the $ namespace alongside $.trim and $.each.