How To Get Timestamp In JavaScript or jQuery

For More Videos Visit Our YouTube Channel

Here we consider how to get timestamp in javascript. To get UTC timestamp in millseconds, you can use

var milliseconds =; -- New Method

var milliseconds = new Date().getTime(); -- Old Method

To get in seconds you can use following code.

var seconds =
Math.floor( / 1000 ); -- New Method

var seconds =
Math.round( new Date().getTime()/1000 ) -- Old Method