Calculating leap years is mainly to determine the number of days in February. Generally, February has 29 days in leap years and 28 days in ordinary years. The algorithm for calculating leap years is very simple, that is: it is divisible by 400, or it is divisible by 4 but not divisible by 100.
The algorithm is as follows:
function isLeapYear(pYear)
set oreg=new RegExp
oreg.Pattern="^d{4}$"
if not oreg.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