繁体   English   中英

如何从 Luxon DateTime object 获取时间戳?

[英]How to get the timestamp from a Luxon DateTime object?

如何从 luxon dateTime object 获取时间戳?

例如?

const { DateTime } = require("luxon");

date = DateTime.now().setZone('utc');
date.endOf('day);

console.log(date.???) // should give something like 1629399474922

这应该等同于 javascript 的Date.getTime() function。

Luxon 文档对此出奇地沉默,但经过一番挖掘,我终于找到了它:

date.toMillis(); 
// or 
date.valueOf(); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM