<HTML>
<body>
</body>
<Script>
function getLastDayOfMonth(year, month){
let date = new Date(year, month + 1, 0);
return date.getDate();
//putting 0 on day roll back the month
//and set the date to be the last date of the month
}
alert(getLastDayOfMonth(2012, 1));
</Script>
</HTML>
<!--
omg this guys are so smart
function getLastDayOfMonth(year, month){
let date = new Date(year, month + 1);
date.setDate(date.getDate() - 1 );
return date.getDate();
}
-->
<body>
</body>
<Script>
function getLastDayOfMonth(year, month){
let date = new Date(year, month + 1, 0);
return date.getDate();
//putting 0 on day roll back the month
//and set the date to be the last date of the month
}
alert(getLastDayOfMonth(2012, 1));
</Script>
</HTML>
<!--
omg this guys are so smart
function getLastDayOfMonth(year, month){
let date = new Date(year, month + 1);
date.setDate(date.getDate() - 1 );
return date.getDate();
}
-->
댓글
댓글 쓰기