Date.prototype.setUTCMonth()
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ì.
setUTCMonth() ë©ìëë íì¤ìì ë°ë¼ ì§ì ë ë ì§ì ìì ì¤ì í©ëë¤.
ìëí´ ë³´ê¸°
const event = new Date("December 31, 1975 23:15:30 GMT-3:00");
console.log(event.toUTCString());
// Expected output: "Thu, 01 Jan 1976 02:15:30 GMT"
console.log(event.getUTCMonth());
// Expected output: 0
event.setUTCMonth(11);
console.log(event.toUTCString());
// Expected output: "Wed, 01 Dec 1976 02:15:30 GMT"
문ë²
setUTCMonth(monthValue)
setUTCMonth(monthValue, dayValue)
매ê°ë³ì
monthValue-
1ììì 12ìê¹ì§ì ìì ëíë´ë 0ìì 11 ì¬ì´ì ì ìì ëë¤.
dayValue-
ì íì ì ë ¥ ê°. í ë¬ì ë ì§ë¥¼ ëíë´ë 1ìì 31 ì¬ì´ì ì ìì ëë¤.
ë°íê°
1970ë 1ì 1ì¼ 00:00:00 UTCì ì ë°ì´í¸ ë ë ì§ ì¬ì´ì ë°ë¦¬ ì´ ì«ìì ëë¤.
ì¤ëª
dayValue ë§¤ê° ë³ì를 ëª
ìíì§ ìì¼ë©´ getUTCDate() ë©ìëìì ë°íë ê°ì´ ì¬ì©ë©ëë¤.
ì§ì í ë§¤ê° ë³ìê° ìì ë²ì를 ë²ì´ë ê²½ì° setUTCMonth()ë ê·¸ì ë°ë¼ Date ê°ì²´ì ë ì§ ì 보를 ì
ë°ì´í¸íë ¤ê³ ìëí©ëë¤. ì를 ë¤ì´ monthValueì 15를 ì¬ì©íë©´ ì°ëê° 1ì© ì¦ê°íê³ 3ì ìì ì¬ì©ë©ëë¤.
ìì
>setUTCMonth() ì¬ì©í기
var theBigDay = new Date();
theBigDay.setUTCMonth(11);
ëª ì¸
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-date.prototype.setutcmonth> |