English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
getTime()returns from1970-1-1 milliseconds passed from 00:00:00 UTC (Coordinated Universal Time) to the date for1970-1-1 a negative value is returned for the time before 00:00:00 UTC.
getTime()The value returned by the method is the number of milliseconds since1970 years1Month1milliseconds since 00:00:00 of the day.
getTime()The method always uses UTC time to represent.getTime()will be the same as the client browser in other time zones.
date.getTime()
var d = new Date(); d.getTime();Test and See‹/›
getTime() method is fully supported by all browsers:
Method | |||||
getTime() | Yes | Yes | Yes | Yes | Yes |
Return Value: | UTC 1970 years1Month1Milliseconds since 00:00:00 UTC on the day |
---|---|
JavaScript Version: | ECMAScript 1 |
Calculate Execution Time:
function myFunc() { var end, start; start = new Date(); for (var i = 0; i < 1000000; i++) { Math.sqrt(i); } end = new Date(); var str = &39;Operation took &39; + (end.getTime() - start.getTime()) + ' msec'; }Test and See‹/›