pubnub/pubnub-api — Issue #56: Convert PubNub TimeToken to Unix Timestamp Seconds
Author: stephenlb
Created: 2011-12-27 00:03:43+00:00
State: open
Labels: FAQ

This is how you take a timetoken from PubNub and convert it to a Unix TimeStamp in seconds:

function timetoken_to_timestamp(timetoken) {
var now = +new Date
, time = +timetoken; // "9430468186259"

return (now - (now % 1000000000)) + (timetoken / 10000);
}