Leap Year
Function/Handler NAME: GetLeapYear ( nYear )
TYPE: Function
Code Created By, Date and Version: Shaderman – Apr-27-2014 – 1.0
Code Description: Check if a year is a leap year
Function/Handler INPUTS: nYear -> The year to check (i.e. 2014)
Function/Handler OUTPUTS: bool value. True if nYear is a leap year, otherwise false.
--------------------------------------------------------------------------------
function SmanDateTime.GetLeapYear ( nYear )
--------------------------------------------------------------------------------
if ( math.mod ( nYear, 400 ) == 0 or math.mod ( nYear, 4 ) == 0 and math.mod ( nYear, 100 ) ~= 0 ) then
return true
else
return false
end
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------