This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

leapyear

Determine leap year

Syntax

ly = leapyear(year)

Description

ly = leapyear(year) determines whether one or more years are leap years or not. The output, ly, is a logical array. year should be numeric.

Examples

Determine whether 2005 is a leap year:

ly = leapyear(2005)

ly =

  0

Determine whether 2000, 2005, and 2020 are leap years:

ly = leapyear([2000 2005 2020])

ly =

  1     0     1

Assumptions and Limitations

The determination of leap years is done by Gregorian calendar rules.

Introduced in R2006b