Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
19 lines (15 sloc) 789 Bytes
title version signature
As ISO 8601 String
2.1.0
moment().toISOString(); moment().toISOString(keepOffset); // from 2.20.0

Formats a string to the ISO8601 standard.

moment().toISOString() // 2013-02-04T22:44:30.652Z

Note that .toISOString() returns a timestamp in UTC, even if the moment in question is in local mode. This is done to provide consistency with the specification for native JavaScript Date .toISOString(), as outlined in the ES2015 specification. From version 2.20.0, you may call .toISOString(true) to prevent UTC conversion.

From version 2.8.4 the native Date.prototype.toISOString is used if available, for performance reasons.