JavaScript getTime () method
Examples
Returns from the number of milliseconds between January 1, 1970:
var d = new Date();
var n = d.getTime();
var n = d.getTime();
n output:
try it"
Definition and Usage
getTime () method returns the number of milliseconds from between January 1, 1970.
Browser Support
All major browsers support getTime () method
grammar
Date .getTime ()
return value
Types of | description |
---|---|
Number | Specified date and time from January 1, 1970 the number of milliseconds midnight (GMT time) between. |
technical details
JavaScript version: | 1.0 |
---|
More examples
Examples
In the following example, we will calculate how many years from date 1970/01/01:
var minutes=1000*60;
var hours=minutes*60;
var days=hours*24;
var years=days*365;
var d=new Date();
var t=d.getTime();
var y=Math.round(t/years);
var hours=minutes*60;
var days=hours*24;
var years=days*365;
var d=new Date();
var t=d.getTime();
var y=Math.round(t/years);
y output:
try it"