As ISO 8601 String2.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 ifavailable, for performance reasons.
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .