Standard built-ins

Date.prototype.toISOString()

Try the free JavaScript compiler

Return UTC date-time string in the specified ISO-like format. Invalid time values throw RangeError. Extended years use signed six digits.

Formal Syntax & Structure

javascript syntaxjavascript
date.toISOString()

Return Value

String

UTC date-time string.

Working Example

Example Snippetjavascript
console.log(new Date(1234).toISOString());
JavaScript Reference