JavaScript toISOString()Method

Date 对象 参考手册JavaScript Date Object

Example

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

var d=new Date();
var n=d.toISOString();

nOutput result:


Try it Yourself »

Definition and Usage

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

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the toISOString() method

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


Syntax

Date.toISOString()

Return Value

Type Description
String Time and date in ISO standard format

Technical Details

JavaScript Version: 1.8


Date 对象 参考手册JavaScript Date Object

Other Extensions