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);
🌐
Epoch Converter
epochconverter.com › daynumbers
What's the Current Day Number?
11 hours ago - This page uses the ISO-8601 ordinal date format. There is also another less-used format: the 'ISO day of year' numbers, this is a number between 1 and 371, day 1 of the year is Monday of the first ISO week (where the first Thursday of the new year is in week 1). Lists of day numbers by year: 2025 - 2026 - 2027 - 2028 ... ... #include <iostream> #include <chrono> int main() { auto now = std::chrono::system_clock::now(); std::chrono::year_month_day current_date{std::chrono::floor<std::chrono::days>(now)}; std::chrono::weekday today{std::chrono::sys_days{current_date}}; // ISO-8601 defines Monday as 1 and Sunday as 7.
🌐
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.
🌐
Time and Date
timeanddate.com › time zones › world clock › usa › new york
Current Local Time in New York, New York, USA
2 days ago - Current local time in USA – New York – New York. Get New York's weather and area codes, time zone and DST. Explore New York's sunrise and sunset, moonrise and moonset.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
When called as a constructor, returns a new Date object. When called as a function, returns a string representation of the current date and time. Date.now() Returns the numeric value corresponding to the current time—the number of milliseconds since January 1, 1970 00:00:00 UTC, with leap ...
Find elsewhere
🌐
Time.is
time.is › New_York
Time in New York, United States now - Time.is
1 week ago - Exact time now, time zone, time difference, sunrise/sunset time and key facts for New York, United States.
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - Using the new Date() Constructor · Passing Individual Date Components · Parsing string to a JavaScript Date · Using Timestamps · How do I get the current date in JavaScript? Current date using JavaScript Date Methods · Current date using the now() method ·
🌐
Sololearn
sololearn.com › en › Discuss › 2967337 › new-date-vs-datenow
new Date vs Date.now() | Sololearn: Learn to code for FREE!
January 22, 2022 - • new Date() - creates a Date object representing the current date/time • Date.now() - returns the number of milliseconds since midnight 01 January, 1970 UTC As a matter of style, I found it clearer to use Date.now() in code that deals with ...
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
It is semantically equivalent to new Date().getTime(), but it doesn’t create an intermediate Date object. So it’s faster and doesn’t put pressure on garbage collection. It is used mostly for convenience or when performance matters, like in games in JavaScript or other specialized applications. ... let start = Date.now(); // milliseconds count from 1 Jan 1970 // do the job for (let i = 0; i < 100000; i++) { let doSomething = i * i * i; } let end = Date.now(); // done alert( `The loop took ${end - start} ms` ); // subtract numbers, not dates
🌐
Time and Date
timeanddate.com
timeanddate.com
Most of the United States begins Daylight Saving Time (DST) on Sunday, March 8, 2026. A new poll shows only 12% support the current system. ... Calculate how many days there are between two dates.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.datetime.now
DateTime.Now Property (System) | Microsoft Learn
The Now property returns a DateTime value that represents the current date and time on the local computer.
🌐
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
import { format, formatDistance, formatRelative, subDays } from 'date-fns' format(new Date(), "'Today is a' eeee") //=> "Today is a Monday" formatDistance(subDays(new Date(), 3), new Date(), { addSuffix: true }) //=> "3 days ago" formatRelative(subDays(new Date(), 3), new Date()) //=> "last Friday at 7:26 p.m."
🌐
Current Millis
currentmillis.com
Current Millis ‐ Milliseconds since Unix Epoch
local date · UTC time · local time · UNIX time · Convert milliseconds · to UTC time & date: to local time & date: UNIX · J2000 · Contact - Mission - Support - Terms © 2013 - 2018 currentmillis.com · Convert local YYYY / MM / DD · and HH : MM : SS ·
🌐
CalendarDate
calendardate.com › todays.htm
Today's Date
2 weeks ago - Details about today's date with count of days, weeks, and months, Sun and Moon cycles, Zodiac signs and holidays.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-now-method
JavaScript Date now() Method - GeeksforGeeks
July 11, 2025 - The code snippet utilizes `Date.now()` to retrieve the current timestamp in milliseconds since the Unix epoch.
🌐
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.