Leap Year Validation

'***************************************************************** '* Function Name : bIsLeapYear * '* Created By : Thomas A. Cassano * '* date : 00/00/97 * '* Purpose : * '* Arguments : * '* Returns : Boolean * '* Comments : None * '***************************************************************** Function bIsLeapYear(dDate as date) as Boolean bIsLeapYear = ((Year(dDate) Mod 4 = 0) _ And (Year(dDate) Mod 100 <> 0)) _ Or (Year(dDate) Mod 400 = 0) End Function


Comments

  • Another way to check for Leap Year

    Posted by Legacy on 12/10/1999 12:00am

    Originally posted by: Rick Rothstein

    First of all, you should only have to pass the year in quesiton into the function, not a specific date. If you only have a date, pass Year(TheDate) into this:

    Function bIsLeapYear(TheYear As Integer) As Boolean
    bIsLeapYear = (DateSerial(TheYear, 2, 29) <> _
    DateSerial(TheYear, 3, 1))
    End Function

    Reply
  • for Current Month Last Day...

    Posted by Legacy on 09/22/1999 12:00am

    Originally posted by: Yon-Jin, KYUNG

    ' Return Last Day of Current Year and Month
    Function fnc_Month_LastDay(intYearValue As Integer, intMonthValue As Integer)

    Select Case intMonthValue

    Case Is = 1, 3, 5, 7, 8, 10, 12
    fnc_Month_LastDay = 31

    Case Is = 4, 6, 9, 11
    fnc_Month_LastDay = 30

    Case Is = 2
    fnc_Month_LastDay = IIf(IsDate(CStr(intYearValue) & "/2/29"), 29, 28)

    End Select

    End Function

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds