سؤال

I connected to https://socketio.mtgox.com/mtgox using socket.io (https://socketio.mtgox.com/socket.io/socket.io.js), and it returned an object that looks like this:

{ 
    exchange: 'mtgox',
    buy: 106.54693,
    sell: 106.99653,
    last: 106.54693,
    vol: 57734.68992687,
    now: 1371584138359638,
    _id: 51c0b68ab3067d631c000002
}

I'm looking for the time and date of the event. There is now:, which appears to be Timestamp, but new Date(1371584138359638); returns Wed Oct 09 45433 05:59:19 GMT-0400 (EDT)

Year 45,433 suggests I'm wrong.

I checked out https://en.bitcoin.it/wiki/MtGox/API/Streaming#Depth, and now: appears in the object, but is not described in the description below.

Any ideas/suggestions?

هل كانت مفيدة؟

المحلول 2

It's in microseconds, and JavaScript uses milliseconds. Divide by 1000.

var dt = new Date(1371584138359638 / 1000);

نصائح أخرى

It's a Unix epoch timestamp in microseconds (0 is 1/1/1970 00:00:00 UTC)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top