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

前端 未结 15 1224
终归单人心
终归单人心 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:24

    Check out Moment.js. It is a modern and powerful library that makes up for JavaScript's woeful Date functions (or lack thereof).

提交回复
热议问题