Baseline Widely available
setMonth()
ë©ìëë íì¬ ì¤ì ë ì°ëì ë°ë¼ ì§ì ë ë ì§ì ìì ì¤ì í©ëë¤.
const event = new Date("August 19, 1975 23:15:30");
event.setMonth(3);
console.log(event.getMonth());
// Expected output: 3
console.log(event);
// Expected output: "Sat Apr 19 1975 23:15:30 GMT+0100 (CET)"
// Note: your timezone may vary
구문
setMonth(monthValue)
setMonth(monthValue, dayValue)
매ê°ë³ì
monthValue
ì°ëì ìììì ì¤íì ë ì°ëì ìì ëíë´ë 0 ê¸°ë° ì ìì ëë¤. ê·¸ëì 0ì 1ì, 11ì 12ì, -1ì ì ë ëì 12ì, 12ë ë¤ì í´ì 1ìì ëíë ëë¤.
dayValue
ì í ì¬í. í ë¬ì ë ì§ë¥¼ ëíë´ë 1ìì 31 ì¬ì´ì ì ìì ëë¤.
1970ë 1ì 1ì¼ 00:00:00 UTCì ì ë°ì´í¸ ë ë ì§ ì¬ì´ì ë°ë¦¬ ì´ ì«ìì ëë¤.
ì¤ëªdayValue
ë§¤ê° ë³ì를 ì§ì íì§ ìì¼ë©´ getDate()
ë©ìëìì ë°í ë ê°ì´ ì¬ì©ë©ëë¤.
ì§ì í ë§¤ê° ë³ìê° ìì ë²ì를 ë²ì´ëë©´ setMonth()
ë ê·¸ì ë°ë¼ Date
ê°ì²´ì ë ì§ ì 보를 ì
ë°ì´í¸íë ¤ê³ ìëí©ëë¤. ì를 ë¤ì´ monthValue
ì 15를 ì¬ì©íë©´ ì°ë ê°ì´ 1 ì¦ê°íê³ ì ê°ì 3ì´ ë©ëë¤.
íì¬ ë ì§ê° ì´ ë©ìëì ëìì ìí¥ì 미칩ëë¤. ê°ë ì ì¼ë¡ ìë¡ì´ ë ì§ë¥¼ ë°íí기 ìí´ ë§¤ê° ë³ìë¡ ì§ì ë ì ë¬ì 첫 ë²ì§¸ ë ì í´ë¹ ìì íì¬ ë ì§ë¡ ì§ì ë ì¼ ì를 ì¶ê°í©ëë¤. ì를 ë¤ì´ íì¬ ê°ì´ 2016ë 8ì 31ì¼ì¸ ê²½ì° setMonthì ë§¤ê° ë³ìì 1ì ë£ê³ í¨ê» í¸ì¶íë©´ 2016ë 3ì 2ì¼ì ë°íë©ëë¤. ì´ë 2016ë 2ìì 29ì¼ì´ ì기 ë문ì ëë¤.
ìì setMonth()
ì¬ì©í기
const theBigDay = new Date();
theBigDay.setMonth(6);
// Watch out for end of month transitions
const endOfMonth = new Date(2016, 7, 31);
endOfMonth.setMonth(1);
console.log(endOfMonth); //Wed Mar 02 2016 00:00:00
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4