How can I convert string to datetime with format specification in JavaScript?

前端 未结 15 1216
终归单人心
终归单人心 2020-11-22 02:35

How can I convert a string to a date time object in javascript by specifying a format string?

I am looking for something like:

var dateTime = convert         


        
15条回答
  •  春和景丽
    2020-11-22 03:21

    Moment.js will handle this:

    var momentDate = moment('23.11.2009 12:34:56', 'DD.MM.YYYY HH:mm:ss');
    var date = momentDate.;
    

提交回复
热议问题