JavaScript Date toISOString() Method

Definition and Usage

toISOString() The method uses the ISO standard to convert the Date object to a string.

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

Example

Return the Date object as a string using the ISO standard:

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

Try It Yourself

Syntax

Date.toISOString()

Parameters

No parameters.

Technical Details

Return Value: A string representing a date and time in ISO standard format.
JavaScript Version: ECMAScript 3

Browser Support

The numbers in the table indicate the first browser version that fully supports this method.

Method Chrome IE Firefox Safari Opera
toISOString() Support Support Support Support Support

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format

Tutorial:JavaScript String