Current unix time / stamp :
var foo = new Date;
Now it is just a question of using the getTime() function on the date object we made, but since getTime() returns milliseconds rather than seconds, we have to divide the result by 1000 as seen below:
var unixtime = parseInt(foo.getTime() / 1000);
var unixtime_to_date = new Date(unixtime*1000);
unixtime_to_date can now be used. If you just print it out, it will state the date of the Unix timestamp you gave it in a format like this: Sat Oct 24 2009 01:23:45 GMT+0200. However, you can also use functions on it to return a more specific value, for example unixtime_to_date.getHours() or unixtime_to_date.getMinutes().