gpt4 book ai didi

javascript - 将 DateTime 转换为特定格式 - Javascript

转载 作者:行者123 更新时间:2023-11-30 11:33:12 24 4
gpt4 key购买 nike

我有以下代码

new Date(1501796503599)

返回值

Fri Aug 04 2017 03:11:43 GMT+0530 (IST)

我需要将上述值显示为 "Today, 3:11 am"。有没有办法做到这一点

最佳答案

var time = moment(1501796503599).calendar();
console.log(time);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script>

关于javascript - 将 DateTime 转换为特定格式 - Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45499978/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com