About This Code
Brief Description:
Check for leapyear
Contributor:
Magnus Nilsson
Type:
Date/Time functions
Notes Version:
R4.x, R5.x, R6.x
Last Modified:
04 Jul 2002
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Checks if the year supplied in variable yearnumber is a leapyear. If the year is a leapyear the variable leapflag is set to 1, otherwise it is set to 0.
'Check for leapyear
'1.Years evenly divisible by four are normally leap years, except for...
'2.Years also evenly divisible by 100 are not leap years, except for...
'3.Years also evenly divisible by 400 are leap years.
If (yearnumber Mod 4) = 0 Then
If (yearnumber Mod 100) = 0 And (yearnumber Mod 400) <> 0 Then
leapflag = 0
Else
leapflag = 1
End If
Else
leapflag = 0
End If
Usage / Example