如何使用 Moment.js 从日期中删除时间?

2024-01-07

formatCalendarDate = function (dateTime) {
    return moment.utc(dateTime).format('LLL');
};

它显示:“2013 年 2 月 28 日 09:24”

但我想删除最后的时间。我怎样才能做到这一点?

我在用着Moment.js http://momentjs.com/.


抱歉这么晚才加入,但如果你想的话removea 的时间部分moment()而不是格式化它,那么代码是:

.startOf('day')

Ref: http://momentjs.com/docs/#/manipulated/start-of/ http://momentjs.com/docs/#/manipulating/start-of/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 Moment.js 从日期中删除时间? 的相关文章

随机推荐