getting timestamp in JavaScript

I am describing here getting timestamp in JavaScript. In development,so many times we do the date and time manipulation and If we need to do it client side means we need to use JavaScript.
timestamp just like Unix’s timestamp, a single number that represents the current time and date. Either as a number or a string.

The following returns the number of milliseconds since since 1 January 1970 00:00:00 UTC.

Or on browsers that support ES5 (notably not IE8 and earlier), you can use

which is really for older browsers:

To get the Unix timestamp such as the one returned by PHP time() function, divide this number by 1000, round or floor if necessary:


jQuery provides its own method to get the timestamp:

Like this Post? Share