toy February 2016

What's the different betweet moment().utc().toISOString() and moment().utc().format()

I'm using moment js library and I'm a bit confused by the result I'm getting about the timezone.

moment().utc().toISOString();
"2016-02-08T23:31:45.317Z"

moment().utc().format();
"2016-02-08T23:32:42+00:00"

What I don't understand is what is 317Z? and What's the difference between toISOString and format And are they the same?

Answers


Kariamoss February 2016

"2016-02-08T23:31:45.317Z" refer to the CCYY-MM-DDTHH:MM:SS.sss time format. 317 is the time in fractions of second while the Z means "Zulu time" (UTC).


Oriol February 2016

In ISO 8601 there are multiple time formats, e.g.

hh:mm:ss.sss
hh:mm:ss

And there are multiple ways to specify the time zone, e.g.

  • Z means UTC time.

  • +00:00 means an offset of zero from UTC. So UTC too.

Post Status

Asked in February 2016
Viewed 3,062 times
Voted 8
Answered 2 times

Search




Leave an answer