ISO dates can be represented without including the day (YYYY-MM).
Example
const d = new Date(“2015-03”); |
The result above will vary between February 28 and March 01 depending on the time zone.
ISO dates can be expressed without specifying the month and day (YYYY).
Example
const d = new Date(“2015”); |
The specified time zone will influence the outcome above, ranging between December 31, 2014, and January 1, 2015. |
ISO dates can include additional details such as hours, minutes, and seconds in the format (YYYY-MM-DDTHH:MM:SSZ):
Example
const d = new Date(“2015-03-25T12:00:00Z”); |
The date and time are separated by a capital T.
UTC time is indicated by a capital letter Z.
To adjust the time relative to UTC, omit the Z and add +HH:MM or -HH:MM instead:
Example
const d = new Date(“2015-03-25T12:00:00-06:30”); |
UTC (Coordinated Universal Time) is synonymous with GMT (Greenwich Mean Time). |
Excluding T or Z in a date-time string may yield different outcomes across various browsers. |