JavaScript Date toISOString()

Example

Get a date as a string, using the ISO standard:

const d = new Date();
let text = d.toISOString();
Try it Yourself »

Description

The toISOString() method returns a date object as a string, using the ISO standard.

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


Browser Support

toISOString() is an ECMAScript5 (ES5) feature.

ES5 (JavaScript 2009) fully supported in all modern browsers since July 2013:

Chrome
23
IE/Edge
10
Firefox
21
Safari
6
Opera
15
Sep 2012 Sep 2012 Apr 2013 Jul 2012 Jul 2013

Syntax

Date.toISOString()

Parameters

None

Technical Details

Return Value: A String, representing the date and time using the ISO standard format
JavaScript Version: ECMAScript 5
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.