0

I have this date-time format in my json '2019-12-15T16:00:50.913Z'

how do i turn it into this:

'December 15, 2019, 4:00 PM'

thanks

x24dsa
  • 17
  • 1
  • 5

1 Answers1

0

You can do it like this:

var dateStr = "2019-12-15T16:00:50.913Z";
var date = new Date(dateStr);

Output: Sun Dec 15 2019 16:00:50 GMT+0000 (Greenwich Mean Time)

It won't output exactly what you said but it will be readable and it's an easy way of doing it.

Further information: https://weblog.west-wind.com/posts/2014/jan/06/javascript-json-date-parsing-and-real-dates#decoding-the-date

Rob Kwasowski
  • 2,690
  • 3
  • 13
  • 32