How to Get the Current Timestamp in JavaScript

Discover the different methods JavaScript provides for generating the current UNIX timestamp. The UNIX timestamp is an integer that represents the number of seconds elapsed since January 1, 1970. On UNIX-like machines, such as Linux and macOS, you can easily find the UNIX timestamp by typing date +%s in the terminal: $ date +%s 1524379940 In JavaScript, the current timestamp can be obtained by calling the now() method on the Date object:...