Converting a string formatted YYYYMMDDHHMMSS into a JavaScript Date object

后端 未结 6 629
借酒劲吻你
借酒劲吻你 2021-01-06 02:33

I have a string with a date in it formatted like so: YYYYMMDDHHMMSS. I was wondering how I would convert it into a JavaScript Date object with JavaScript.

Thanks in

6条回答
  •  南笙
    南笙 (楼主)
    2021-01-06 03:16

    Date functions from this library can help: http://javascripttoolbox.com/lib/date/ , it's free and very simple to use.

    If you want to do it yourself, I would suggest looking up the javascript regular expressions, as I guess that is the way to achieve this best

提交回复
热议问题