Calendar`
Calendar`

DateQ

As of Version 10.0, calendar functionality is built into the Wolfram Language »

DateQ[{year,month,day}]

yields True if date {year,month,day} is a valid date in the current calendar system, and yields False otherwise.

DateQ[{year,month,day,hour,minute,second}]

date given in long form {year,month,day,hour,minute,second}.

Details and Options

Examples

open allclose all

Basic Examples  (5)

DateQ recognizes ordinary Western dates:

DateQ will identify leap years. The year 2000 was a leap year:

The year 1900 was not a leap year:

By default, the Wolfram Language uses the standard Western (British/American) calendar. The British/American calendar applies the Julian calendar to dates before 1752 and the Gregorian calendar after:

The default British/American calendar deletes the dates September 3 to 13, 1752:

Options  (6)

Calendar  (6)

Catholic countries adopted the modern Gregorian calendar in 1582, while Britain and her colonies observed the Julian calendar until 1752. By default, the Wolfram Language uses the British calendar, so dates in Catholic countries after October 14, 1582 and before September 14, 1752 require the Gregorian option.

In France, 1700 was not a leap year:

Britain was still using the Julian calendar, where all centuries were leap years:

Catholic countries did not delete any days in September 1752:

The Russian Orthodox church has retained the Julian calendar. Their year 1900 was a leap year:

The Islamic calendar has leap years (the 12th month has 29 or 30 days):

The Jewish calendar has a leap month (13 months):

Applications  (3)

DateQ can identify leap years:

The default calendar is Julian for dates prior to 1752, so 1700 is given as a leap year:

In Catholic countries, the Gregorian calendar was already used, so 1700 was not a leap year:

DateQ can identify Islamic leap years (the 12th month has 30 days):

The year 1400 was not a leap year:

The year 1401 was a leap year:

DateQ can identify Jewish years with a leap month (the year has 13 months):

The year 5760 had a leap month

The year 5761 did not have a leap month: