MSDN Library

toISOString Method (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 required objDate reference is a Date object.

The ISO format is a simplification of the ISO 8601 format. For more information, see Formatting 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 Internet Explorer 9 standards document mode. See Version Information.

Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards.

Community Additions

© 2015 Microsoft