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

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

但是我想把最后的时间去掉。我该怎么做呢?

我用的是Moment.js。


当前回答

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

其他回答

尝试new Date().toDateString()

推荐-“2022年六月17日”

我迟到了,但这对我来说非常有效:

moment().format('YYYY-MM-DD')

试试这个:

moment.format().split("T")[0]

你也可以使用这种格式:

时刻()。格式(“ddd、ll ');// 2017年1月4日,星期三

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