Home >Web Front-end >JS Tutorial >Summary of methods for obtaining the current timestamp in javascript_javascript skills
JavaScript to get the current timestamp:
First method:
var timestamp = Date.parse(new Date());
Result: 1280977330000
Second method:
var timestamp = (new Date()).valueOf();
Result: 1280977330748
The third method:
var timestamp=new Date().getTime();
Result: 1280977330748
The first method: the timestamp obtained is to change the milliseconds to 000 for display,
The second and third methods are to obtain the timestamp of the current millisecond.
The above is the entire content of this article, I hope you all like it.