JavaScript날짜setMonth

setMonth날짜

월을 설정합니다 (0~11).

문법

date.setMonth(month)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

const
new
setMonth
December
indexed
console
getMonth
const date = new Date();
date.setMonth(11);   // December (0-indexed)
console.log(date.getMonth());   // 11