ASP leap year Calculation Method

Source: Internet
Author: User

The Calculation of a leap year is mainly used to determine the number of days in January. Generally, the year of a leap year is 29 days, and the year of the Year of the year is 28 days. Calculate the leap yearAlgorithmIt is very simple, that is, it can be divided by 400, or it can be divided by 4, but not 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.