如何从Moment.js中删除日期? [英] How can I remove time from date with Moment.js?

查看:317
本文介绍了如何从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?

我正在使用 Moment.js

推荐答案

很抱歉这么晚才进入,但如果你想删除时间片刻()的一部分而不是格式化它,然后代码是:

Sorry to jump in so late, but if you want to remove the time portion of a moment() rather than formatting it, then the code is:

.startOf('day')

参考: http://momentjs.com/docs/#/manipulating/start-of/

这篇关于如何从Moment.js中删除日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆