728x90 반응형 날짜1 [JS] 날짜 계산하는 방법 (월, 일 구하기) 1. 01일~말일까지 계산하는 날짜 var now = new Date(); var year = now.getFullYear(); var month = ("0" + (now.getMonth() + 1)).slice(-2); var date = ("0" + new Date(year, month, 0).getDate()).slice(-2); var firstDay = new Date(year+"-"+month+"-"+"01"); var endDay = new Date(year+"-"+month+"-"+date); firstDay = 2022-06-01 endDay = 2022-06-30 1) getFullYear = 현재 년도를 가져온다 2) now.getMonth()+1 = 해당 월을 가져온다 ( +1 일 .. 2022. 6. 9. 이전 1 다음 728x90 반응형