Date.prototype.toISOString()
Date 实例的 toISOString() 方法返回表示 日期时间字符串格式 中该日期的字符串,日期时间字符串格式 是基于 ISO 8601 的简化格式,长度始终为 24 或 27 个字符(分别为 YYYY-MM-DDTHH:mm:ss.sssZ 或 ±YYYYYY-MM-DDTHH:mm:ss.sssZ)。时区始终为 UTC,由后缀 Z 表示。
¥The toISOString() method of Date instances returns a string representing this date in the date time string format, a simplified format based on ISO 8601, which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always UTC, as denoted by the suffix Z.
Try it
语法
参数
返回值
¥Return value
一个字符串,表示根据世界时间的 日期时间字符串格式 中的给定日期。与 Date.parse() 需要识别的格式相同。
¥A string representing the given date in the date time string format according to universal time. It's the same format as the one required to be recognized by Date.parse().
例外情况
示例
使用 toISOString()
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-date.prototype.toisostring |
浏览器兼容性
BCD tables only load in the browser