How do you get a timestamp in JavaScript?

Posted by Editorial Staff | Updated on

Are you searching for how do you get a timestamp in JavaScript? Use the following JavaScript code get a timestamp. On almost all current browsers you can use Date.now() to get the UTC timestamp in milliseconds; a notable exception to this is IE8 and earlier.

Timestamp in Milliseconds

To get the timestamp in seconds, you can use:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers