윤년

it/programming

javascript (jQuery) 윤년 처리하기

연도가 4로 나뉘어지면 윤년인데 4로 나뉘지 않고 100으로 나뉘어지면 평년이다.단, 4로 나뉘어지고 100으로도 나뉘어지면 윤년이다. $.passMonth = function($year, $month) { if($month == 2) { if((( $year % 4 == 0 && $year % 100 != 0 ) || $year % 400 ==0)) return 29; return 28; } else if($month % 2 == 0) { if($month < 8) return 30; return 31; } else { if($month < 8) return 31; return 30; } }

반응형
훈솔
'윤년' 태그의 글 목록