DayOfWeek
DayOfWeek[{year,month,day}]
gives the day of the week on which the given date {year,month,day} occurred.
DayOfWeek[{year,month,day,hour,minute,second}]
gives the day of the week for the given date.
更多信息和选项
- To use DayOfWeek, 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.
范例
打开所有单元关闭所有单元基本范例 (6)
The Declaration of Independence was signed on a Thursday:
The Bastille was stormed on a Tuesday:
Canada became an independent nation on a Monday:
Wolfram Research began on a Saturday:
This gives the day of the week at the time the formula was input:
Hours, minutes, and seconds do not affect the day of the week:
Options (5)
Calendar (5)
Dates in Catholic countries after October 14, 1582 and before September 14, 1752 require the Gregorian option. Louis XIV was born on a Sunday:
Russian Orthodox dates require the Julian option. Russian Orthodox Christmas 2000 was on a Sunday:
The Islamic calendar begins on a Friday:
This date corresponds to one attribution of the Hegira, July 16, 622, in the Western (Julian) calendar:
By definition, Yom Kippur cannot fall on a Friday or Sunday:
Because the Jewish calendar has a leap month preceding Passover, the Wolfram Language uses a numbering starting with Nisan, the month of Passover, and Tishrei, the first month of the Jewish year, is number 7:
Applications (2)
Possible Issues (1)
The Western calendar was modified from Julian to Gregorian for better accuracy. The change deleted 10 days in October 1582 in Catholic countries and deleted 11 days in September 1752 in Britain and her colonies. By default, the Wolfram Language applies the British (American) version. These calendar changes did not affect the day of the week, so there is an issue for DayOfWeek concerning dates after October 14, 1582 and before September 14, 1752. For British dates, the default gives the correct answer. For dates in Catholic countries, it is necessary to use the Gregorian option for Calendar.
The calendar change did not affect days of the week:
George Washington was born on a Tuesday:
Voltaire was born on a Sunday:
Dates after September 2, 1752 and before September 14, 1752 are not accepted by the Automatic option. Use the Gregorian or Julian option for these dates (valid only for non-British Western countries):