Easy Tutorial
❮ Dom Obj Text Prop Style Flexflow ❯

JavaScript getTime() Method

JavaScript Date Object

Example

Returns the number of milliseconds since January 1, 1970:

n Output result:


Definition and Usage

The getTime() method returns the number of milliseconds since January 1, 1970.


Browser Support

All major browsers support the getTime() method.


Syntax

Return Value

Type Description
Number The number of milliseconds between the specified date and time and midnight of January 1, 1970 (GMT time).

Technical Details

| JavaScript Version: | 1.0 | | --- | --- |


More Examples

Example

In the following example, we will calculate how many years have passed since 1970/01/01:

y Output result:


JavaScript Date Object

❮ Dom Obj Text Prop Style Flexflow ❯