DateQ
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
- To use DateQ, you first need to load the Calendar Package using Needs["Calendar`"].
- The following options can be given:
-
Calendar Automatic specify which calendar system to use - The default calendar is the usual Western (American) calendar, but can be changed with the Calendar option.
- Valid settings for Calendar are Automatic, Julian, Gregorian, Islamic, and Jewish.
Examples
open allclose allBasic 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):
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):