JavaScript Date.now()

Examples

let ms = Date.now();
Try it Yourself »

Calculate the number of years since 1970/01/01:

const minute = 1000 * 60;
const hour = minute * 60;
const day = hour * 24;
const year = day * 365;

let years = Math.round(Date.now() / year);
Try it Yourself »

Description

Date.now() returns the number of milliseconds since January 1, 1970.

Notes

Date.now() is a static method of the Date object.

You cannot use it on a date like myDate.now()

The syntax is always Date.now().



Syntax

Date.now()

Parameters

NONE

Return Value

A number.

The number of milliseconds since midnight January 1, 1970 00:00:00 UTC.


Browser Support

Date.now() is an ECMAScript5 (ES5) feature.

ES5 (JavaScript 2009) fully supported in all modern browsers since July 2013:

Chrome
23
IE/Edge
10
Firefox
21
Safari
6
Opera
15
Sep 2012 Sep 2012 Apr 2013 Jul 2012 Jul 2013


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.