Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript toISOString() Method

JavaScript toISOString() Method

Date Object Reference JavaScript Date object

Example

Returns the string format of a Date object using the ISO standard:

var d=new Date();

var n=d.toISOString();

n Output result:

Try it »


Definition and Usage

The toISOString() method converts a Date object to a string using the ISO standard.

This standard is called ISO-8601, with the format: YYYY-MM-DDTHH:mm:ss.sssZ


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the toISOString() method

Note: Internet Explorer 8 and earlier versions of IE do not support the toISOString() method.


Syntax

Date

.toISOString()

Return Value

Type Description
String Date and time in ISO standard format

Technical Details

JavaScript version: 1.8

Date Object Reference JavaScript Date object