特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> ASP教程> asp下闰年计算方法

asp下闰年计算方法

时间:2009-06-25 17:33:34 作者:互联网

计算闰年主要是为了判断2月份的天数,一般闰年2月份是29天,平年2月份是28天。计算闰年的算法非常简单,即:能被400整除,或者能被4整除而不能被100整除。

算法如下:

 function isLeapYear(pYear)
    set oreg=new RegExp
    or***Pattern="^d{4}$"
    if not or***Test(pYear) then
        isLeapYear=false
        exit function
    end if
    oYear=clng(pYear)
    if ((oYear mod 4=0 and oYear mod 100<>0) or oYear mod 400=0) then
       isLeapYear=true
    else
       isLeapYear=false
    end if
 end function

相关文章 最新文章

相关应用

热门文章

猜你喜欢

返回顶部