自己写可函数搞定啊(能被4整除 && 不能被100整除) || 能被400整除
//闰年

解决方案 »

  1.   

    写了一个,请大家指正:
      public static int getDaysCount(Integer yearInt,Integer monthInt)
    {
    int daysCount=30;
    int year,month;
    year=yearInt.intValue();
    month=monthInt.intValue();
    Integer[] o=new Integer[]{new Integer(1),new Integer(3),new Integer(5),new Integer(7),new Integer(8),new Integer(10),new Integer(12)};
    List forCompare=Arrays.asList(o);
    if(forCompare.contains(monthInt))
    {
    daysCount=31;
    return daysCount;
    }
    if(month!=2)
    return daysCount;
    if((month /4 ==0 && month/100!=0)||month /400 ==0)
    daysCount=29;
    else
    daysCount=28;
    return daysCount;
    }
      

  2.   

    呵呵,发现一个错误,if((month /4 ==0 && month/100!=0)||month /400 ==0)中的month应该是year
      

  3.   

    <script>
    function isDate(str)
    {
        var d = new Date(str)
        return !isNaN(d)
    }
    </script>
      

  4.   


    没有直接的。
    用我这个函数最简短了。Function GetMonthDays(y,m)        '''参数:年,月
    dim s
    s = CDate(y &"-"& m & "-1")
    GetMonthDays = DateDiff("d",s,DateAdd("m",1,s))
    End Function
    或者:
    Function GetMonthDays(varDate)    '''参数:日期
    dim s
    s = CDate(Year(varDate) &"-"& Month(varDate) & "-1")
    GetMonthDays = DateDiff("d",s,DateAdd("m",1,s))
    End Function