Skip to content

toISOString ​

The toISOString() function transforms a TheDate into an ISO 8601 string (YYYY-MM-DDTHH:mm:ss.sssZ).

Interactive example ​

Syntax ​

typescript
function toISOString<
	GenericInput extends TheDate | SerializedTheDate
	>(
	input: GenericInput
): string

Parameters ​

  • input: The date to convert.

Return value ​

An ISO 8601 string representing the date.

See also ​

Sources ​

Released under the MIT license.