如何使用moment.js从日期中删除时间? [英] How can I remove time from my date with moment.js?
本文介绍了如何使用moment.js从日期中删除时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
formatCalendarDate = function (dateTime) {
return moment.utc(dateTime).format('LLL');
};
它显示:28 februari 2013 09:24
It displays: "28 februari 2013 09:24"
但是我想删除最后的时间怎么办?
But I would like to remove the time at the end how can I do that?
推荐答案
对不起,迟到了,但如果你真的想要删除一段时间()的时间部分,而不仅仅是格式化,那么代码是:
Sorry to jump in so late, but if you're really wanting to remove the time portion of a moment() rather than just formatting it, then the code is:
.startOf('day')
参考: http://momentjs.com/docs/#/manipulating/start-of/
这篇关于如何使用moment.js从日期中删除时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文