-2

Recently, need to parse a date from partner's API,

the return format is json, and there is a date string as 2018-01-26T12:00:00.000Z.

BTW, previously, usually I get the timestamp as a long value, which is not effected by timezone.

The questions are:

  • Is it possible to tell the timezone of this date?
  • If yes, then what is the timezone, and any reference/document about this format of timezone?
Eric
  • 22,183
  • 20
  • 145
  • 196
  • You can use moment.js for all date operations. Moment.js is having very easy and powerful api to handle dates. – rajk Jan 25 '18 at 03:24
  • 1
    The `Z` is for Zulu which is UTC time https://en.wikipedia.org/wiki/ISO_8601 – charlietfl Jan 25 '18 at 03:24
  • This post maybe useful for you:
    https://stackoverflow.com/questions/11770367/use-javascript-to-convert-a-date-string-with-timezone-to-a-date-object-in-local
    – jack Jan 25 '18 at 03:29
  • This post maybe useful for you:
    https://stackoverflow.com/questions/11770367/use-javascript-to-convert-a-date-string-with-timezone-to-a-date-object-in-local
    – jack Jan 25 '18 at 03:30
  • @charlietfl Thanks, btw the wikipedia says the Z is for `zero` UTC offset – Eric Jan 25 '18 at 06:07
  • It also mentions Zulu several times in Timezone Designators section – charlietfl Jan 25 '18 at 12:34
  • @charlietfl I guess both of the 2 meaning are correct, could refer to this: https://stackoverflow.com/a/8405125/1568658 – Eric Jan 25 '18 at 13:19
  • Right. I have always considered it Zulu but good to know all references – charlietfl Jan 25 '18 at 13:24
  • Just to be pedantic - The ISO 8601 spec calls `Z` the "UTC designator". It makes no mention of either "Zero" or "Zulu". However, RFC3339 does reference that it is "..often spoken "Zulu" from the ICAO phonetic alphabet...". But yes, IMHO, either are acceptable. – Matt Johnson-Pint Jan 25 '18 at 22:21

1 Answers1

2

ISO Dates (Date-Time) can be written with added hours, minutes, and seconds (YYYY-MM-DDTHH:MM:SSZ) e.g. 2015-03-25T12:00:00Z

Date and time is separated with a capital T.

UTC time is defined with a capital letter Z.

UTC (Universal Time Coordinated) is the same as GMT (Greenwich Mean Time).

Dan
  • 951
  • 1
  • 23
  • 46
  • 1
    Believe it or not, it's actually "Coordinated Universal Time" - and the letters are intentionally out of sequence. https://en.wikipedia.org/wiki/Coordinated_Universal_Time#Etymology – Matt Johnson-Pint Jan 25 '18 at 05:07