View Single Post
  #2 (permalink)  
Old March 6th, 2004, 12:05 PM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If your two digit year is contained in iYear then:
[code]
Dim dblQuarter as Double
dblQuarter = iYear/4
If dblQuarter = CInt(dblQuarter) Then
'Result is integer
Else
'Result is not integer
End If
[code]
Of course this test is not valid as 1900 was not a leap but 2000 was. If you trust Microsoft's date processing you could just see if the 29th February was a valid date:
Code:
Function IsLeapYear(iSomeYear As Long) As Boolean
  IsLeapYear = Month(DateSerial(iSomeYear, 2, 29)) = 2
End Function
This constructs a date based on 29th February and tests whether the month is still February or has moved to March.

--

Joe
Reply With Quote