-
Using Date() to convert ISO 8601 time to UTC
Hey everyone!
I’m trying to convert ISO 8601 dates I have to readable dates with expressions.
So far I’ve been able to get the current date and print it with this:date = new Date(0);
parsed = date.toString().split(" ").slice(1, 4).join(", ");
parsed;outputs the date as Sep, 24, 2018.
However, when I try to plug in my ISO 8601 format time…
text = "2018-08-06T00:00:00.000Z";
date = new Date(text);
parsed = date.toString();parsed;
I get : “Invalid Date” as my return value.
Does anybody here see any immediate flaws or have some advice for me?
Thanks,
Nick