LeapYearQ
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") number AbsoluteTime specification - The following options can be given:
-
CalendarType "Gregorian" calendar in which the date parameters have been specified
Examples
open all close allBasic Examples (4)
Find whether a date is in a leap year:
LeapYearQ[DateObject[{1959, 8, 29}, "Day", "Gregorian", -6.]]Use a compact DateList:
LeapYearQ[{1959}]An AbsoluteTime specification is allowed:
DateList[3*^9]LeapYearQ[3*^9]LeapYearQ["2024"]Options (3)
CalendarType (3)
A leap year in the Jewish calendar is defined as a year of 13 months:
LeapYearQ[{#}, CalendarType -> "Jewish"]& /@ Range[5770, 5780]In the Islamic tabular calendar, leap years are defined as those years that have a 30-day 12th month:
LeapYearQ[{#}, CalendarType -> "Islamic"]& /@ Range[1430, 1460]In the Julian calendar, every fourth year is a leap year:
LeapYearQ[{#}, CalendarType -> "Julian"]& /@ Range[1890, 1900]Applications (1)
Find the periodicity of leap years in different calendars by analyzing a range of 5000 years:
findLeapYearPeriod[calendar_] := Module[{leapQ, repeat},
leapQ = LeapYearQ[{#}, CalendarType -> calendar]& /@ Range[5000];
repeat = FindRepeat[leapQ];
{Count[repeat, True], Length[repeat]}
]In the Julian calendar, every fourth year is a leap year:
findLeapYearPeriod["Julian"]There are 97 leap years every 400 years in the Gregorian calendar:
findLeapYearPeriod["Gregorian"]In the Jewish calendar, there are 7 leap years every 19 years:
findLeapYearPeriod["Jewish"]There are 11 leap years in each cycle of 30 years of the tabular Islamic calendar:
findLeapYearPeriod["Islamic"]Possible Issues (1)
LeapYearQ accepts both DateList and AbsoluteTime specifications, so numeric inputs are treated as a number of seconds since 1900:
LeapYearQ[1996]For year specifications, either a DateList or DateObject form should be used:
LeapYearQ[{1996}]LeapYearQ[DateObject[{1996}, "Year", "Gregorian", -6.]]Related Guides
Text
Wolfram Research (2012), LeapYearQ, Wolfram Language function, https://reference.wolfram.com/language/ref/LeapYearQ.html (updated 2014).
CMS
Wolfram Language. 2012. "LeapYearQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/LeapYearQ.html.
APA
Wolfram Language. (2012). LeapYearQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LeapYearQ.html
BibTeX
@misc{reference.wolfram_2026_leapyearq, author="Wolfram Research", title="{LeapYearQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/LeapYearQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_leapyearq, organization={Wolfram Research}, title={LeapYearQ}, year={2014}, url={https://reference.wolfram.com/language/ref/LeapYearQ.html}, note=[Accessed: 13-June-2026]}