[英]Getting date/time from Mt. Gox's “now” value using socket.io?
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: 我使用socket.io( https://socketio.mtgox.com/socket.io/socket.io.js )连接到
https://socketio.mtgox.com/mtgox
,它返回了一个看起来像这样的对象:
{
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);
now:
,似乎是时间戳记,但是new Date(1371584138359638);
returns Wed Oct 09 45433 05:59:19 GMT-0400 (EDT)
返回
Wed Oct 09 45433 05:59:19 GMT-0400 (EDT)
Year 45,433 suggests I'm wrong. 45,433年表明我错了。
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. 我签出了https://en.bitcoin.it/wiki/MtGox/API/Streaming#Depth ,
now:
出现在对象中,但在下面的描述中未进行描述。
Any ideas/suggestions? 有什么想法/建议吗?
这是Unix纪元时间戳,以微秒为单位(0为1/1/1970 00:00:00 UTC)
It's in microseconds, and JavaScript uses milliseconds. 以毫秒为单位,JavaScript使用毫秒。 Divide by 1000.
除以1000。
var dt = new Date(1371584138359638 / 1000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.