LeapYearQ

LeapYearQ[date]

returns True if the year corresponding to date is a leap year.

Details and Options

  • The date can be specified in the following forms:
  • DateObject[]date object
    {y,m,d}year, month, day
    {y,m}the first day of the specified month
    {y}the first day of the first month of the year y
    "string"date as a string ("Jan. 1, 2000")
    numberAbsoluteTime specification
  • The following options can be given:
  • CalendarType"Gregorian"calendar in which the date parameters have been specified

Examples

open allclose all

Basic Examples  (4)

Find whether a date is in a leap year:

Use a compact DateList:

An AbsoluteTime specification is allowed:

Use a string specification:

Options  (3)

CalendarType  (3)

A leap year in the Jewish calendar is defined as a year of 13 months:

In the Islamic tabular calendar, leap years are defined as those years that have a 30-day 12th month:

In the Julian calendar, every fourth year is a leap year:

Applications  (1)

Find the periodicity of leap years in different calendars by analyzing a range of 5000 years:

In the Julian calendar, every fourth year is a leap year:

There are 97 leap years every 400 years in the Gregorian calendar:

In the Jewish calendar, there are 7 leap years every 19 years:

There are 11 leap years in each cycle of 30 years of the tabular Islamic calendar:

Possible Issues  (1)

LeapYearQ accepts both DateList and AbsoluteTime specifications, so numeric inputs are treated as a number of seconds since 1900:

For year specifications, either a DateList or DateObject form should be used:

Introduced in 2012
 (9.0)
 |
Updated in 2014
 (10.0)