formatCalendarDate = function (dateTime) {
return moment.utc(dateTime).format('LLL');
};
它显示:“2013 年 2 月 28 日 09:24”
但我想在最后删除时间。我怎样才能做到这一点?
我正在使用 Moment.js 。
原文由 Obsivus 发布,翻译遵循 CC BY-SA 4.0 许可协议
formatCalendarDate = function (dateTime) {
return moment.utc(dateTime).format('LLL');
};
它显示:“2013 年 2 月 28 日 09:24”
但我想在最后删除时间。我怎样才能做到这一点?
我正在使用 Moment.js 。
原文由 Obsivus 发布,翻译遵循 CC BY-SA 4.0 许可协议
尝试 new Date().toDateString()
结果 - “2022 年 6 月 17 日星期五”
原文由 suthar pavan 发布,翻译遵循 CC BY-SA 4.0 许可协议
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
抱歉这么晚才加入,但如果你想 删除
moment()
的时间部分而不是 格式化 它,那么代码是:参考:http: //momentjs.com/docs/#/manipulating/start-of/