toISOString (JavaScript)

Gets a string representing the local date and time in ISO format.

Defined in

Date (Standard - JavaScript)

Syntax

toISOString() : string
Return value Description
string The string representation of the date and time.

Usage

The International Organization for Standardization (ISO) standard 8601 specifies the order year, month, day, hour, minute, second. See http://www.iso.org/iso/catalogue_detail?csnumber=40874.

Examples

(1) This computed label displays the current date and time.
var date = new Date();
date.toISOString()
// 2008-11-26-11.25.36

(2) This computed label displays the base date and time (where the time zone is -5).

var date = new Date(0);
date.toISOString()
// 1970-01-01-01.00.00