Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

toISOString Method (Date) (JavaScript)

Returns a date as a string value in ISO format.


A string representation of the date in International Organization for Standardization (ISO) format.

If objDate does not contain a valid date, a RangeError exception is thrown.

The ISO format is a simplification of the ISO 8601 format. For more information, see Date and Time Strings (JavaScript).

The time zone is always UTC, denoted by the suffix Z in the output.

The following example illustrates the use of the toISOString method.

var dt = new Date("30 July 2010 15:05 UTC");
document.write("<br />");

// Output:
//  2010-07-30T15:05:00.000Z
//  Fri, 30 Jul 2010 15:05:00 UTC

Supported in the following document modes: Internet Explorer 9 standards, Internet Explorer 10 standards, and Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information. Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards.

© 2015 Microsoft