Showing entries with tag "Javascript".

Found 4 entries

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 Date.now() which returns milliseconds since the epoch with less typing required.

var unixtime = parseInt(Date.now / 1000);
Leave A Reply

Javascript: Unixtimes and Leap Seconds

There is going to be a leap second today at 1230768000 (2008 December 31, 23h 59m 60s). I updated my Javascript Unixtime converter to include options for UTC time. Happy Leap Seconds!

Leave A Reply

Javascript Unixtime

Just a note of how to get Unixtime in Javascipt.

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

Also a Javascript Unixtime conversion utility.

Leave A Reply - 11 Replies

Javascript Unixtime converter

I always end up trying to figure out what a unixtime is in human readable format, or vice versa. I ended up borrowing and updating a tool from captain.at, striping out all the ads and other junk and cleaning it up so it's XHTML compliant. Check out my new and improved javascript unixtime converter.

Leave A Reply