如何将Solana块时间转换为正常时间?
我正在使用solana api,并且由于一个函数,我得到了这样的响应:
{
blockTime: 1646251782,
confirmationStatus: 'finalized',
err: null,
memo: null,
signature: 'xyz',
slot: 123192670
}
如您所见,有blocktime
字段,我想从中提取值。当我使用MONK
进行此操作时:
console.log(moment(1646251782).toISOString())
我有1970年,但这是不正确的,我在Solana Explorer上检查了一下,并且有正常的时间。我如何获得正常约会或我做错了什么?
I'm using solana API and as a result of one function I get such response:
{
blockTime: 1646251782,
confirmationStatus: 'finalized',
err: null,
memo: null,
signature: 'xyz',
slot: 123192670
}
As you can see, there is blockTime
field, and I want to extract value from it. When I was doing it with moment
:
console.log(moment(1646251782).toISOString())
I got 1970 year, but it's incorrect, and I check this on solana explorer, and there was normal time. How can I get normal date or what do I do wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是
unix
以毫秒为单位的时间,使用时刻您可以使用以下时间提取时间:This is
unix
time in milliseconds, using moment you can extract time using this: