0

Using Javascript how do I convert ISO string 2013-08-10T12:10:15.474Z into a date ()object. do not use moment

I want to end up with HH MM SS MM DD YYYY

date.parse converts the string into milliseconds since 1/1/70 That is not what I want.

Herbie
  • 77
  • 1
  • 5
  • 1
    What happened when you tried `new Date('2013-08-10T12:10:15.474Z')`? Or `Date.parse()`? – nnnnnn Nov 03 '17 at 01:51
  • What about using `Date.parse('2013-08-10T12:10:15.474Z')`? – m00n Nov 03 '17 at 01:54
  • 5
    Possible duplicate of [Change ISO Date String to Date Object - JavaScript](https://stackoverflow.com/questions/27012854/change-iso-date-string-to-date-object-javascript) – admcfajn Nov 03 '17 at 01:57
  • 1
    Date.parse() does not return a date object... – dandavis Nov 03 '17 at 02:15
  • Regarding your edit, and the desired output format, if you just need a string in a different format and not a `Date()` object the easiest way is to do it all as string manipulation: a one-liner with the string `.replace()` method and a regex. – nnnnnn Nov 03 '17 at 02:30

1 Answers1

6

You can use new Date('2013-08-10T12:10:15.474Z') or Date.parse('2013-08-10T12:10:15.474Z').

m00n
  • 1,977
  • 2
  • 13
  • 25