한글 연간 달력 (source code) by 토마스 정

= 2000 && $year <= 2099) { echo "

$year 연간 달력

"; echo ""; $monthNames = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']; $dayNames = ['일', '월', '화', '수', '목', '금', '토']; for ($row = 0; $row < 4; $row++) { // 4 rows echo ""; for ($col = 1; $col <= 3; $col++) { // 3 months per row $month = ($row * 3) + $col; $monthName = $monthNames[$month - 1]; echo ""; } echo ""; } echo "
"; echo "

$monthName

"; echo ""; echo ""; foreach ($dayNames as $dayName) { echo ""; } echo ""; $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); $startDay = date('w', mktime(0, 0, 0, $month, 1, $year)); echo ""; for ($i = 0; $i < $startDay; $i++) echo ""; for ($day = 1; $day <= $daysInMonth; $day++) { $class = (($startDay + $day - 1) % 7 == 0) ? "sunday" : ""; echo ""; if (($startDay + $day) % 7 == 0) echo ""; } while (($startDay + $daysInMonth) % 7 != 0) { echo ""; $startDay++; } echo "
$dayName
$day
"; } else { echo "

유효한 연도(2000~2099)를 입력하세요.

"; } } ?>