When I try this new Date('2015-01-25T17:00:00.000Z')
it will returning the next date Jan 26 2015 00:00:00
, this is an expected behaviour for me, but why it is like this?
Is there any explanation from this js behaviour when using TZ with value of OO:OO:OO.
CodePudding user response:
The Z
at the very end means "Zulu Time" which is another word for UTC.
The result you see in your console is the time in your current timezone. You are probably 5 hours ahead of UTC.
If you remove the Z
, the output you get is the same as what you put in, because Javascript will use local time by default.
CodePudding user response:
UTC (Zulu) time is '2015-01-25T17:00:00.000Z'. The local time in Jakarta is UTC 7: Jan 26 2015 00:00:00
.
See Time in Indonesia and ISO 8601.