pvl_leapyear
Determine if a given year is a leap year using 400 year cycles.
Contents
Syntax
LY = pvl_leapyear(Year)
Description
Determines if a given year, Year, in the Gregorian calendar is a leap year (a year with 29 days in the second month).
Inputs
- Year - must be numeric, but may be of any size. If Year is not an integer, the fractional part will be removed (floor function).
Outputs
- LY - is a boolean true 1 if the year is a leap year, and a boolean false if the year is not a leap year. LY is of the same size as Year, with LY(i) corresponding to Year(i).
Example 1
Check whether 2012 is a leap year (is a leap year because 2012 is divisible by 4)
pvl_leapyear(2012)
ans = 1
Example 2
Check whether 2011 is a leap year (is not a leap year because 2011 is not divisible by 4)
pvl_leapyear(2011)
ans = 0
Example 3
Check whether 1900 is a leap year (is not a leap year because 1900 is divisible by 100 but is not divisible by 400)
pvl_leapyear(1900)
ans = 0
See Also
Copyright 2014 Sandia National Laboratories