날짜 검증하는 스크립트입니다.

 

function CheckDate(Year, Month, Day) {
    try {

            var OK = false;

            var LeapYear = (((Year % 4) == 0) && ((Year % 100) != 0) || ((Year % 400) == 0));   
                    
            if (Month == 1) {  
                OK = LeapYear ? Day <= 29 : Day <= 28;
            } 
            else {
                if ((Month == 3) || (Month == 5) || (Month == 8) || (Month == 10)) {
                    OK = Day <= 30;
                }
                else {
                    OK = Day <= 31;
                }
            }             
            //alert(OK?'Yes':'No');
            return OK;        
    }
    catch (e) {
        return false;
    }
}

 

Year, Month, Day 확인은 하지 않습니다. ^^;

 

행복한 고수되셔요...

 

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\




Posted by woojja