Date.prototype.toISOString()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
toISOString() ë©ìëë ë¨ìíí íì¥ ISO íì(ISO 8601)ì 문ìì´ì ë°íí©ëë¤.
ë°íê°ì ì¸ì ë 24ê¸ì ëë 27ê¸ì(ê°ê° YYYY-MM-DDTHH:mm:ss.sssZ ëë
±YYYYYY-MM-DDTHH:mm:ss.sssZ)ì
ëë¤.ìê°ëë ì¸ì ë UTCì´ë©° ì ë¯¸ì´ Zë¡ ííí©ëë¤.
ìëí´ ë³´ê¸°
const event = new Date("05 October 2011 14:48 UTC");
console.log(event.toString());
// Expected output: "Wed Oct 05 2011 16:48:00 GMT+0200 (CEST)"
// Note: your timezone may vary
console.log(event.toISOString());
// Expected output: "2011-10-05T14:48:00.000Z"
구문
js
toISOString()
ë°í ê°
주ì´ì§ ë ì§ë¥¼ êµì íì¤ì ê¸°ì¤ ISO 8601 íìì¼ë¡ ííí 문ìì´.
Date.parse()ìì ì¸ìí´ì¼ íë íìê³¼ ëì¼í©ëë¤.
ìì
>toISOString() ì¬ì©í기
js
const today = new Date("05 October 2011 14:48 UTC");
console.log(today.toISOString()); // Returns 2011-10-05T14:48:00.000Z
ì ìì ë ë¹íì¤ ë¬¸ìì´ì ë¶ìì í¬í¨íê³ ìì´ Mozilla ì¸ì ë¸ë¼ì°ì ììë ì¬ë°ë¥´ê² ìëíì§ ìì ì ììµëë¤.
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-date.prototype.toisostring> |