Get a date as a string, using the ISO standard:
const d = new Date();
let text = d.toISOString();
Try it Yourself »
The toISOString() method returns a date object as a string, using the ISO standard.
The standard is called ISO-8601 and the format is: YYYY-MM-DDTHH:mm:ss.sssZ
toISOString()
is an ECMAScript5 (ES5) feature.
ES5 (JavaScript 2009) fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 9-11 |
Date.toISOString()
None |
Return Value: | A String, representing the date and time using the ISO standard format |
---|---|
JavaScript Version: | ECMAScript 5 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!