从UTCMilliseconds获取日期

问题描述 投票:-1回答:1

我有这个日期

str : string = new Date().getUTCMilliseconds().toString()

但是当我再次约会时:

new Date(str);

不是预期的日期

javascript node.js typescript
1个回答
-1
投票

您可以尝试这个。

let str = new Date().getUTCMilliseconds().toString();
console.log(new Date().setUTCMilliseconds(str));
© www.soinside.com 2019 - 2024. All rights reserved.