Javascript Date toString convert and format to local time

后端 未结 3 2013
囚心锁ツ
囚心锁ツ 2021-01-28 02:37

I have a script that gets a date/time in the the format of:

2017-06-15 21:00

and then converts it to local time and displays as:



        
3条回答
  •  醉梦人生
    2021-01-28 02:52

    If you can use an external library, I'd suggest this one liner using momentjs:

    moment('2017-06-15 21:00').format('ffffd MMM DD YYYY h:mm:ss A')
    // => "Thu Jun 15 2017 9:00:00 PM"
    

提交回复
热议问题