I am currently getting the date and time from my database in this format 2019-01-17 10:20:00. Is it possible to change this format to 17 January 2019 10.20 pm to display? I am Using ajax call in JS to retrieve the data. Any help available? Thanks
Asked
Active
Viewed 48 times
1 Answers
0
Did you try toUTCString()
console.log(new Date('2019-01-17 10:20:00').toUTCString())

A l w a y s S u n n y
- 36,497
- 8
- 60
- 103
-
Not recommended to pass non valid ISO formatted strings to `new Date`. Will get inconsistent results across different environments – charlietfl Dec 19 '18 at 15:43