instance method Date#toISOString

View source on GitHub →

Date#toISOString() → String

Produces a string representation of the date in ISO 8601 format. The time zone is always UTC, as denoted by the suffix "Z".

Example
var d = new Date(1969, 11, 31, 19);
d.getTimezoneOffset();
//-> -180 (time offest is given in minutes.)
d.toISOString();
//-> '1969-12-31T16:00:00Z'