Javascript: Get a unixtime value

I need a Unixtime in Javascript. This is the simplest way I came up with to get that value:

var unixtime = parseInt(new Date().getTime() / 1000);

Update: Newer versions of Javascript (and browsers) now offer which returns milliseconds since the epoch with less typing required.

var unixtime = parseInt( / 1000);
Leave A Reply
All content licensed under the Creative Commons License