![](/img/trans.png)
[英]how to import an UTC timestamp to Luxon as it is? (Migrating from Moment)
[英]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.