How can I remove time from date with Moment.js?

后端 未结 11 2242
予麋鹿
予麋鹿 2020-11-28 03:04
formatCalendarDate = function (dateTime) {
    return moment.utc(dateTime).format(\'LLL\');
};

It displays: \"28 februari 2013 09:24\"

But

11条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-28 03:56

    You can use this constructor

    moment({h:0, m:0, s:0, ms:0})
    

    http://momentjs.com/docs/#/parsing/object/

    console.log( moment().format('YYYY-MM-DD HH:mm:ss') )
    
    console.log( moment({h:0, m:0, s:0, ms:0}).format('YYYY-MM-DD HH:mm:ss') )

提交回复
热议问题