# is Leap Year

Returns true if the specified \a year is a leap-year in the Gregorian calendar (contains 29days in February).
Open Office: ISLEAPYEAR

Controller: **CodeCogs**

**Contents**

## Interface

C++

Excel

## IsLeapYear

boolisLeapYear( | int | year | )[inline] |

*Year*is a within a leap year. In the Gregorian* calendar a typical year has 365 97/400 days = 365.2425 days. Therefore there are 97 leap years in every 400 years. To facilitate this a leap year occurs when:

- the year is divisible by 4 but not divisible by 100, or
- the year is divisible by 400

**Note**this is not to be confused with the Julian date system standard that CodeCogs has adopted which defined any date as the number of days from 24 November 4714 BC in the Gregorian calendar (or the number of days from 1 January 4713BC in the Julian Calendar)

### Example 1

- To output the number of days in each month of 1974
#include <stdio.h> #include <codecogs/units/date/isleapyear.h> int main() { for(int i=1900; i<2010; i++) printf("\n%d %s a leap year", i, Units::Date::isLeapYear(i) ? "is":"is not"); return 0; }

### Note

- A leap year in the Julian calendar is simply any year divisible by 4, so we see no reasons to supply this as a distinct function. But here's the code (!!):
bool isJulianLeapYear= !(Year%4);

### Authors

*Will Bateman (Sep 2004)*

##### Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.