There are several ways to get the current time in JavaScript:

  • new Date() creates a Date object representing current date/time
  • new Date().valueOf() returns number of milliseconds since midnight 01 January, 1970 UTC
  • new Date().getTime() Functionally equivalent to new Date().valueOf()
  • Date.now() Functionally equivalent to the 2 methods above

As mentioned in the comments and MDN links, Date.now() is not supported in Internet Explorer 8. So if IE 8 compatibility is a concern you should use new Date().valueOf() at the cost of slightly diminished code readability.

Or if you want to use Date.now() but must be compatible with browsers which don't support it, you can place following code somewhere in your JavaScript files, which will add support for it.

if (!Date.now) {
    Date.now = function() {
        return new Date().getTime();
    }
}
Answer from Bohuslav Burghardt on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › now
Date.now() - JavaScript | MDN
// This example takes 2 seconds to run const start = Date.now(); console.log("starting timer..."); // Expected output: "starting timer..." setTimeout(() => { const ms = Date.now() - start; console.log(`seconds elapsed = ${Math.floor(ms / 1000)}`); // Expected output: "seconds elapsed = 2" }, 2000);
🌐
W3Schools
w3schools.com › jsref › jsref_now.asp
JavaScript Date now() Method
Date.now() returns the number of milliseconds since January 1, 1970.
Discussions

approximate-now: A faster Date.now() alternative
I’ve never seen Date.now() be a performance issue. What inspired this? More on reddit.com
🌐 r/javascript
25
1
December 25, 2020
Can you explain Date.prototype.getDate() vs. Date.now() in other words built-in object method differences
I think the difference is now() is a class method and getDate() is an instance method Am I right? More on reddit.com
🌐 r/javascript
8
3
March 1, 2018
Weird JavaScript date problem: new Date('MM/dd/yyyy') !== new Date('yyyy-MM-dd')
It is consistent: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse . A huge mess, but consistent and specified. More on reddit.com
🌐 r/javascript
13
4
August 8, 2014
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
Returns a new Temporal.Instant object with the same epochMilliseconds value as this date's timestamp. ... Returns the "time" portion of the Date as a human-readable string. ... Converts a date to a string using the UTC timezone. ... Returns the primitive value of a Date object. Overrides the Object.prototype.valueOf() method. ... Converts this Date object to a primitive value. The following examples show several ways to create JavaScript dates:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-now-method
JavaScript Date now() Method - GeeksforGeeks
July 11, 2025 - The Date.now() method in JavaScript returns the current timestamp in milliseconds since January 1, 1970. This method doesn’t require creating a new date object, making it one of the fastest and most efficient ways to capture the current time ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › Date
Date() constructor - JavaScript | MDN
// reduced time precision with `privacy.resistFingerprinting` enabled new Date().getTime(); // Might be: // 1519129853500 // 1519129858900 // 1519129864400 // … · The following examples show several ways to create JavaScript dates:
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - The simplest way to create a Date object with today’s date in JavaScript is by using the new keyword.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › javascript-date-now-how-to-get-the-current-date-in-javascript
JavaScript Date Now – How to Get the Current Date in JavaScript
June 15, 2020 - It returns the value in milliseconds that represents the time elapsed since the Epoch. You can pass in the milliseconds returned from the now() method into the Date constructor to instantiate a new Date object:
🌐
Medium
medium.com › @anandgupta20588 › date-now-vs-new-date-e744520ba762
Date.now() vs new Date. new Date: When you use new Date, it… | by Anandgupta | Medium
November 3, 2023 - It's an instance of the Date object containing not just the timestamp but also various methods to work with dates and times. Date.now(): This method returns the number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC.
🌐
W3Schools
w3schools.com › js › js_date_methods.asp
JavaScript Date Methods
In JavaScript, date objects are created with new Date().
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
There’s a special method Date.now() that returns the current timestamp. It is semantically equivalent to new Date().getTime(), but it doesn’t create an intermediate Date object.
🌐
Medium
medium.com › @techsolutionstuff › node-js-get-current-date-and-time-example-e7893d95c174
Node JS Get Current Date And Time Example | by Techsolutionstuff | Medium
September 29, 2023 - Get the current timestamp using Date.now() method. Note that this method returns the timestamp in milliseconds.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-get-current-date-todays-date-in-js
JavaScript Get Current Date – Today's Date in JS
November 7, 2024 - In JavaScript, we can easily get the current date or time by using the new Date() object.
🌐
CoreUI
coreui.io › answers › how-to-get-the-current-date-in-javascript
How to get the current date in JavaScript · CoreUI
October 1, 2025 - For UTC time specifically, use new Date().toISOString(), and for Unix timestamps, use Date.now() which returns milliseconds since epoch. Angular · Bootstrap · React.js · Vue.js · Follow Łukasz Holeczek on GitHub Connect with Łukasz Holeczek ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › difference-between-new-date-and-datenow-in-javascript
Difference Between new Date() and Date.now() in JavaScript - GeeksforGeeks
August 5, 2025 - Example: This example shows the use of new Date() constructor. ... The Date.now() method returns the numeric value corresponding to the current time—the number of the milliseconds elapsed since January 1, 1970, 00:00:00 UTC.
🌐
Reddit
reddit.com › r/javascript › approximate-now: a faster date.now() alternative
r/javascript on Reddit: approximate-now: A faster Date.now() alternative
December 25, 2020 - You see, if you call Date.now 6 million times, it takes 0.00001 seconds longer than the alternative method! ... OP develops a reasonably popular JSON logger. I'm guessing something came up that required this. Instead of embedding this in that library, he put it as a seperate package for anyone else doing large quantities of logging. ... If someone is calling Date.now() frequently enough to make it worthwhile to make it more efficient, they’re probably not going to want to sacrifice accuracy for it because there’d be no point in calling it so frequently.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › UTC
Date.UTC() - JavaScript | MDN
const utcDate = new Date(Date.UTC(2018, 11, 1, 0, 0, 0)); Date.UTC() when passed one argument used to have inconsistent behavior, because implementations only kept the behavior consistent with the Date() constructor, which does not interpret a single argument as the year number. Implementations are now required to treat omitted monthIndex as 0, instead of coercing it to NaN.
🌐
Educative
educative.io › answers › what-is-datenow-in-javascript
What is Date.now() in Javascript?
In Javascript, the .now() method is a Date static method that returns the number of milliseconds since January 1, 1970 00:00:00 UTC.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getTime
Date.prototype.getTime() - JavaScript | MDN
The getTime() method of Date instances returns the number of milliseconds for this date since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC. const moonLanding = new Date("July 20, 69 20:17:40 GMT+00:00"); // Milliseconds since Jan 1, 1970, 00:00:00.000 GMT console.log(moonLanding.getTime()); // Expected output: -14182940000
🌐
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.