No Time to Read - Copy/Paste Solution

function getCurrentTimestamp () {


The UNIX timestamp is defined as the number of seconds since January 1, 1970 UTC. In JavaScript, in order to get the current timestamp, you can use

It's important to note that will return the number of milliseconds since January, 1 1970 UTC. If you need the number of seconds, you'll need to divide the result by 1000.

function getTimestampInSeconds () {
return Math.floor( / 1000)

The Date class is full of all sorts of handy methods. If you're doing anything with dates in JavaScript, you'll want to use it. You can find the complete API here.