javascriptdatetimeiso

ISO 8601 and [T], [Z] characters


Is it correct, that [T] and [Z] both characters indicate about UTC time format.

Furthermore [T] just split date and time parts?

var dates = [
  '2016-05-03',         // date only: UTC
  '2016-05-03Z',        // Z character: UTC
  '2016-05-03 00:00',   // exist time, missing T & Z: local
  '2016-05-03 00:00Z',  // exist Z: UTC
  '2016-05-03T00:00',   // exist T: UTC
  '2016-05-03T00:00Z'   // exist Z, T: UTC
];

dates.map(function(d) {  
  document.writeln(d + ':' + Date.parse(d) + '<br />');
});


Solution

  • Yes, you're right:

    The T is just a literal to separate the date from the time,

    And the Z means "Zulu time" (UTC). From that post.

    More on T and Z in wikipedia article on ISO 8601

    If the time is in UTC, add a Z directly after the time without a space.