# Leap Year Validation

### WEBINAR:On-Demand

Application Security Testing: An Integral Part of DevOps

'***************************************************************** '* 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

• #### 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

• #### 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

• You must have javascript enabled in order to post comments.

## Top White Papers and Webcasts

• As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
• The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
• Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

## Most Popular Programming Stories

• There have been no articles posted today.