javascript - 如何从 Luxon DateTime 对象中获取时间戳?
问题描述
如何从 luxon dateTime 对象获取时间戳?
例如?
const { DateTime } = require("luxon");
date = DateTime.now().setZone('utc');
date.endOf('day);
console.log(date.???) // should give something like 1629399474922
这应该相当于javascript的Date.getTime()
功能。
解决方案
Luxon 文档对此出奇地沉默,但经过一番挖掘,我终于找到了它:
date.toMillis();
// or
date.valueOf();
推荐阅读
- windows-10 - IBM-Watson 学术试验未启动
- amazon-web-services - 如何在 Elastic Beanstalk 服务器上创建文件夹以使用 AcmePHP 安装 LetsEncrypt SSL 证书
- mongodb - 如何在 MongoDB 中组合 $lookup
- unity3d - Unity:我没有收到 AdMob 横幅或插页式广告
- ios - IBOutlet 变量在我尝试访问它们时返回 nil。错误:线程 1:致命错误:在展开可选值时意外发现 nil
- docker - Docker 容器日志不再出现在 Docker 撰写日志中
- atom-editor - 在 atom 中安装 Hydrogen 包的问题
- amazon-web-services - AWS CLI - 获取名称以字符串开头的所有 CloudFormation 堆栈
- pyspark - 如何在不使用循环的情况下更新数据框
- r - 如何使用模块化闪亮应用阅读、显示和下载 Excel