|
|
Line 1: |
Line 1: |
| There are various methods to '''calculate the day of the week''' for any particular date in the past or future. These methods ultimately rely on [[algorithms]] to determine the day of the week for any given date, including those based solely on tables as found in [[perpetual calendars]] that require no calculations to be performed by the user. A typical application is to calculate the day of the week on which someone was born or any other specific event occurred.
| | == 秦Yuはこの招待の手を取った == |
|
| |
|
| A '''calendrical savant''' (or calendar [[savantism|savant]]) is someone who—though [[mentally disabled]]—can name the day of the week of a date, or vice versa<ref>Do to the operation ‘in reverse’, e.g., identifying the date of the third Monday in a specified month of a year</ref> in a few seconds or even a tenth of a second, on a limited range of decades or certain millennia.<ref name="calsavants2007">{{cite journal| author=Kennedy DP, Squire LR| title=An analysis of calendar performance in two autistic calendar savants. | journal=Learn Mem | year= 2007 | volume= 14 | issue= 8 | pages= 533–8 | pmid=17686947 | doi=10.1101/lm.653607 | pmc=1951792 | url=http://www.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&tool=sumsearch.org/cite&retmode=ref&cmd=prlinks&id=17686947 }}</ref> These savants are mostly [[autistic]]. Non-autistic savant calculators tend to have [[borderline mental retardation|below-average cognitive functions]].<ref name="pmidhttp://www.ncbi.nlm.nih.gov/pubmed/6545414/">{{cite journal| author=O'Connor N, Hermelin B| title=Idiot savant calendrical calculators: maths or memory? | journal=Psychol Med | year= 1984 | volume= 14 | issue= 4 | pages= 801–6| doi= | pmc= | url=http://www.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&tool=sumsearch.org/cite&retmode=ref&cmd=prlinks&id=6545414 }}</ref> The rarity of human calendar calculators is likely due to the lack of motivation and encouragement to develop such a skill among most normally functioning children.<ref name="calsavants2009">{{cite journal| author=Cowan R, Frith C| title=Do calendrical savants use calculation to answer date questions? A functional magnetic resonance imaging study. | journal=Philos Trans R Soc Lond B Biol Sci | year= 2009 | volume= 364 | issue= 1522 | pages= 1417–24 | pmid=19528025 | doi=10.1098/rstb.2008.0323 | pmc=2677581 | url=http://www.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&tool=sumsearch.org/cite&retmode=ref&cmd=prlinks&id=19528025 }}</ref> Calendrical savants, on the other hand, may not be prone to invest in socially engaging skills.<ref name="calsavants2009"/>
| | ヤングは述べています。<br><br>若い男少し弓と:.言った '。秦氏ゆう姜瑜シャン次回、風水盛黄陛下は私が招待秦氏ゆうこれが招待され、雪の街を追加しました。'<br>を取得することは困難<br> [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_14.php クリスチャンルブタン サイズ]。秦Yuはこの招待の手を取った [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_11.php クリスチャンルブタン 偽物]。<br><br>江シャンは私は突然彼の顔に幸せな表情を持っていた。結局のところ、単に連続6人。秦Yuはいずれ招待を選択しませんでした。しかし、秦Yuは後に招待状を受け取った。大声でため息をついて言った: [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_2.php クリスチャンルブタン 東京] '私はモミの弟、雪の街に私は非常に良い印象が、私はこれだけ残念ヒョン金山を、約束しているから」<br><br>姜瑜シャン李鄭。最後に、唯一しぶしぶ首を横に振った [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_3.php クリスチャンルブタン 値段]。<br>秦ゆう顔の色が非常に強い後悔<br>。良好であると実際に長い秦ゆう心。李の子供たちが結婚し、現在は過去を走ったために、LANシュウとの交流は、後でもう一度出た後、賢い、およびこれらの調製のため、一杯になっていない。<br><br>「この三者の人は、デュアルドメイン島、山の悪魔の血、修羅ハイチ人でなければならないが、私は彼らに精通していないよ。導入されていない [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_6.php クリスチャンルブタン アウトレット]。「黄福ジンは軽く言った。<br>Huangfu静かな音を聞く<br>、 |
| | 相关的主题文章: |
| | <ul> |
| | |
| | <li>[http://www7a.biglobe.ne.jp/~to_a_you_sake/cgi-bin/senkoto_bbs/joyful.cgi http://www7a.biglobe.ne.jp/~to_a_you_sake/cgi-bin/senkoto_bbs/joyful.cgi]</li> |
| | |
| | <li>[http://jianbaoke.com/bbs/forum.php?mod=viewthread&tid=1643632&extra= http://jianbaoke.com/bbs/forum.php?mod=viewthread&tid=1643632&extra=]</li> |
| | |
| | <li>[http://www.eita-web.com/eitabbs/epad.cgi http://www.eita-web.com/eitabbs/epad.cgi]</li> |
| | |
| | </ul> |
|
| |
|
| ==Introduction== | | == その後、数ヶ月が表示されます紫色Jianmangの == |
|
| |
|
| To determine the day of the week from numerical operations, Sunday to Saturday is represented as numbers (usually from 0 to 6, respectively, which is equivalent to [[ISO 8601]]'s alternative usage of 1 = Monday to 7 = Sunday). This is achieved with [[Modular arithmetic|arithmetic modulo]] 7. Modulo 7 is an operation that calculates the remainder of a number being divided by 7. Thus the number 7 is treated as 0, 8 as 1, 9 as 2, 18 as 4 and so on; the interpretation of this being that if Sunday is signified as day 0, then 7 days later (i.e. day 7) is also a Sunday, and day 18 will be the same as day 4, which is a Thursday since this falls 4 days after Sunday.
| | カジュアルの魔方陣トップクラスの専門家の1本に集まった、彼らはそれらを得妨げる者があるとは思わない [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_1.php クリスチャンルブタン 東京]。<br>今<br> [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_4.php クリスチャンルブタン通販]。彼らの唯一の心配は、最終的に誰が秦ゆうを殺すために起こっているということです [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_2.php クリスチャンルブタン 日本]!<br>皇后のヶ月<br>本当の良い外観は言った: 'ここ数カ月で、私はあなたを知っていると私たちはそのように膠着状態が続けば、火の邪悪な王を殺すことができるようにするときかわからない、この日に憎悪極めて邪悪な王の火を持っている。私は関係なく、彼がどのように、アヴェンジド考えられて殺され、誰の、火の邪悪な王を攻撃するために一緒に私たちをみましょう......参照してください? [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_7.php クリスチャンルブタン 取扱店] '<br>一瞬皇后思考の<br>ヶ月、このような妥協は稀だっただろうと言って何明良本当の高い位置にかかわら。彼女も数ヶ月は、あまりにも多くのことはできません。<br>皇后の手の中に」そう言って、すべて本当の良いので、私は戻って一歩を踏み出す [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_12.php クリスチャンルブタン 値段]。よく、私達の両方が彼を殺したに関係なくは復讐とみなされ、このShazhao秦ゆうを攻撃するために出て行った。」<br>その後、数ヶ月が表示されます紫色Jianmangの。<br><br>本当の良い目がライトアップ:「パープル陳健、Lianyinムーンタウン宮殿の宝の使用、私はCangzhuoことができないこと。 |
| | 相关的主题文章: |
| | <ul> |
| | |
| | <li>[http://www5e.biglobe.ne.jp/~calico/joyful/azukityami.cgi http://www5e.biglobe.ne.jp/~calico/joyful/azukityami.cgi]</li> |
| | |
| | <li>[http://www.commonapp.com.cn/plus/feedback.php?aid=2 http://www.commonapp.com.cn/plus/feedback.php?aid=2]</li> |
| | |
| | <li>[http://www.timo-wichmann.de/cgi-bin/gstiftsruine/guestbook.cgi http://www.timo-wichmann.de/cgi-bin/gstiftsruine/guestbook.cgi]</li> |
| | |
| | </ul> |
|
| |
|
| The basic approach of nearly all of the methods to calculate the day of the week begins by starting from an ‘anchor date’: a known pair (such as January 1, 1800 as a Wednesday), determining the number of days between the known day and the day that you are trying to determine, and using arithmetic modulo 7 to find a new numerical day of the week.
| | == this mysterious green energy and meteor tears relevant == |
|
| |
|
| One standard approach is to look up (or calculate, using a known rule) the value of the first day of the week of a given century, look up (or calculate, using a method of congruence) an adjustment for the month, calculate the number of leap years since the start of the century, and then add these together along with the number of years since the start of the century, and the day number of the month. Eventually, one ends up with a day-count on which one applies modulo 7 to determine the day of the week of the date.<ref>Richards, E.G. (1999). Mapping Time: The Calendar and Its History. Oxford University Press.</ref>
| | My hand flew out.<br><br>'This green light group in the end is what?' Qin Yu looked at my hand green Guanghua, whispered softly.<br><br>'Huh.' Qin Yu was puzzled when Qin Yu suddenly found himself chest meteor tears even smell [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_3.php クリスチャンルブタン 値段] a green light point, that green spot directly [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_8.php クリスチャンルブタン パンプス] flew just Qin Yu collection site green light group, complementing the where green energy.<br><br>'meteor tears!'<br><br>Qin Yu eyes lit up, 'really not what I expected, this mysterious green energy and meteor tears relevant, since [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_10.php クリスチャンルブタン ブーツ] the meteor tears when I inhaled, it has been a meteor tears from my control, but I can at least now ...... Control of these green energy. '<br><br>Qin Yu mind a move. Identify the main revenue body had [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_10.php クリスチャンルブタン ブーツ] blood that brush fly out. But [http://www.lamartcorp.com/modules/mod_menu/rakuten_cl_4.php クリスチャンルブタン セール] at the moment it is a two-edged dagger brush appearance. Emperor left against the central cents cents to the product, though the body is a brush. But on the attack than in the general goods Legend should be stronger.<br><br>Qin Yu took the product Zhebing cents shortsighted, directly into the self |
| | | 相关的主题文章: |
| Some methods do all the additions first and then cast out sevens, whereas others cast them out at each step, as in [[Determination of the day of the week#Lewis Carroll.27s method|Lewis Carroll's method]]. Either way is quite viable: the former is easier for calculators and computer programs; the latter for mental calculation (it is quite possible to do all the calculations in one's head with a little practice). None of the methods given here perform range checks, so that unreasonable dates will produce erroneous results.
| | <ul> |
| | | |
| '''SAMPAT MANE's Method to find day of any date:'''
| | <li>[http://www.bcb.cn/plus/feedback.php?aid=91991 http://www.bcb.cn/plus/feedback.php?aid=91991]</li> |
| D=d+m+yy+q+c;
| | |
| Where
| | <li>[http://www.blacklungpapa.com/index.php?title=User:Oopxnwnz#of_course_they_are_like_the_extreme http://www.blacklungpapa.com/index.php?title=User:Oopxnwnz#of_course_they_are_like_the_extreme]</li> |
| d=day of month;
| | |
| m=month offset. Following is the list of months with corresponding month offsets.
| | <li>[http://trend-news18.com/homeserver/cgi-bin/bbs/light.cgi http://trend-news18.com/homeserver/cgi-bin/bbs/light.cgi]</li> |
| month Month offset
| | |
| January 0
| | </ul> |
| February 3
| |
| March 3
| |
| April 6
| |
| May 1
| |
| June 4
| |
| July 6
| |
| August 2
| |
| September 5
| |
| October 0
| |
| November 3
| |
| December 5
| |
| | |
| yy=Last two digits of the year.
| |
| q=quotient of (yy/4).
| |
| c=century offset
| |
| century=first two digit of year*100;
| |
| Remainder of(Century/400) Century offset
| |
| 0 6
| |
| 100 4
| |
| 200 2
| |
| 300 0
| |
| | |
| R=Remainder of(D/7).
| |
| R Day
| |
| 0 Sunday
| |
| 1 Monday
| |
| 2 Tuesday
| |
| 3 Wednesday
| |
| 4 Thursday
| |
| 5 Friday
| |
| 6 Saturday
| |
| If we want to find day of months January or February of leap year then subtract 1 from D.
| |
| e.g.
| |
| find day of 3 April 1989.
| |
| Here,
| |
| d=3,
| |
| m=6,
| |
| yy=89,
| |
| q=89/4=22,
| |
| century=1900,
| |
| c=0,
| |
| D=3+6+89+22+0=120.
| |
| R=Remainder of(120/7)=1
| |
| 1=Monday. Therefore Monday is day of 3 April 1989.
| |
| | |
| ==Useful concepts==
| |
| | |
| ===Corresponding months===
| |
| "Corresponding months" are those months within the calendar year that start on the same day. For example, September and December correspond, because September 1 falls on the same day as December 1. Months can only correspond if the number of days between their first days is divisible by 7, or in other words, if their first days are a whole number of weeks apart. For example, February corresponds to March because February has 28 days, a number divisible by 7, 28 days being exactly four weeks.
| |
| In a [[leap year]], January and February correspond to different months than in a [[common year]], since February 29 means each subsequent month starts a day later.
| |
| | |
| The months correspond thus:<br />
| |
| For common years:
| |
| *January and October.
| |
| *February, March and November.
| |
| *April and July.
| |
| *No month corresponds to August.
| |
| For leap year:
| |
| *January, April and July.
| |
| *February and August.
| |
| *March and November.
| |
| *No month corresponds to October.
| |
| For all years:
| |
| <!--Please do not add month pairs that duplicate the other sections of this list. This section is only for months not already mentioned in the first 2 sections.--> | |
| *September and December.
| |
| *No month corresponds to May or June.
| |
| In the months table below, corresponding months have the same number, a fact which follows directly from the definition.
| |
| | |
| ===Corresponding years===
| |
| <!--The example given is to be updated every 4 years. Its next update should be in 2015, then 2019, and so on.-->
| |
| | |
| There are seven possible days that a year can start on, and leap years will alter the day of the week after February 29. This means that there are 14 configurations that a year can have. All the configurations can be referenced by a [[Dominical letter]]. For example, 2011 is a [[common year starting on Saturday]], meaning that 2011 corresponds to the 2005 [[calendar year]]. 2012, on the other hand, is a [[leap year starting on Sunday]], meaning that the first two months of the year begin on the same day as they do in 2006 (i.e. January 1 is a Sunday and February 1 is a Wednesday) but because of [[leap day]] the last ten months correspond to the last ten months in 2007 (i.e. March 1 is a Thursday, etc.).
| |
| | |
| ==A tabular method to calculate the day of the week==
| |
| | |
| ===Basic method for mental calculation===
| |
| This method is valid for both the [[Gregorian calendar]] and the [[Julian calendar]]. Britain and its colonies started using the Gregorian calendar on Thursday, September 14, 1752 (the previous day was Wednesday, September 2, 1752 [[Old Style and New Style dates|(Old Style)]]. The areas now forming the United States adopted the calendar at different times depending on the colonial power: Spain and France had been using it since 1582, while Russia was still using the [[Julian calendar]] when Alaska was purchased from it in 1867.
| |
| | |
| The formula is <math>d + m + y + \left\lfloor\frac{y}{4}\right\rfloor + c \mod {7}</math>, where:
| |
| * ''d'' is the day of the month,
| |
| * ''m'' is the month's number in the [[Determination of the day of the week#Months table|months table]],
| |
| * ''y'' is the last two digits of the year, and
| |
| * ''c'' is the century number. For a Gregorian date, this is 6 if the first two digits of the year are evenly divisible by 4, and subsequent centuries are 4-2-0 (so the century numbers for 2000, 2100, 2200, and 2300 are respectively 6, 4, 2, and 0). For a Julian date, this is 6 for 1200, and subsequent centuries subtract 1 until 0, when the next century is 6 (so 1300 is 5, and 1100 is 0).
| |
| | |
| If the result is 0, the date was a Sunday; if 1 it was a Monday, and so on through the week until 6 = Saturday.
| |
| | |
| ===Days table===
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| ! colspan="5"|Date || '''d'''
| |
| ! colspan="1"|Day
| |
| |-
| |
| | 01 || 08 || 15 || 22 || 29 || '''1''' || Monday
| |
| |-
| |
| | 02 || 09 || 16 || 23 || 30 || '''2''' || Tuesday
| |
| |-
| |
| | 03 || 10 || 17|| 24 || 31 || '''3''' || Wednesday
| |
| |-
| |
| | 04 || 11 || 18 || 25 || || '''4''' || Thursday
| |
| |-
| |
| | 05 || 12 || 19 || 26 || || '''5''' || Friday
| |
| |-
| |
| | 06 || 13 || 20 || 27 || || '''6''' || Saturday
| |
| |-
| |
| | 07 || 14 || 21 || 28 || || '''0''' || Sunday
| |
| |}
| |
| | |
| ===Months table===
| |
| | |
| {| border="1" class="wikitable"
| |
| |-
| |
| |Month || '''m''' || Leap years
| |
| |-
| |
| | January || '''0'''
| |
| ! colspan="1"|-1
| |
| |-
| |
| | February || '''3'''
| |
| ! colspan="1"|2
| |
| |-
| |
| | March || '''3'''
| |
| |-
| |
| | April || '''6'''
| |
| |-
| |
| | May || '''1'''
| |
| |-
| |
| | June || '''4'''
| |
| |-
| |
| | July || '''6'''
| |
| |-
| |
| | August || '''2'''
| |
| |-
| |
| | September || '''5'''
| |
| |-
| |
| | October || '''0'''
| |
| |-
| |
| | November || '''3'''
| |
| |-
| |
| | December || '''5'''
| |
| |}
| |
| | |
| ===Years table===
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| ! colspan="18" | The year modulo 100
| |
| ! |'''y'''
| |
| |-
| |
| | 00 || 06 || || 17 || 23 || '''28''' || 34 || || 45 || 51 || '''56''' || 62 || || 73 || 79 || '''84''' || 90 || || '''0'''
| |
| |-
| |
| | 01 || 07 || 12 || 18 || || 29 || 35 || 40 || 46 || || 57 || 63 || 68 || 74 || || 85 || 91 || 96 || '''1'''
| |
| |-
| |
| | 02 || || 13 || 19 || 24 || 30 || || 41 || 47 || 52 || 58 || || 69 || 75 || 80 || 86 || || 97 || '''2'''
| |
| |-
| |
| | 03 || 08 || 14 || || 25 || 31 || 36 || 42 || || 53 || 59 || 64 || 70 || || 81 || 87 || 92 || 98 || '''3'''
| |
| |-
| |
| | || 09 || 15 || 20 || 26 || || 37 || 43 || 48 || 54 || || 65 || 71 || 76 || 82 || || 93 || 99 || '''4'''
| |
| |-
| |
| | 04 || 10 || || 21 || 27 || 32 || 38 || || 49 || 55 || 60 || 66 || || 77 || 83 || 88 || 94 || || '''5'''
| |
| |-
| |
| | 05 || 11 || 16 || 22 || || 33 || 39 || 44 || 50 || || 61 || 67 || 72 || 78 || || 89 || 95 || || '''6'''
| |
| |}
| |
| | |
| ===Centuries table===
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| ! colspan="1" |Gregorian calendar
| |
| ! colspan="1" | Julian calendar ||
| |
| |-
| |
| |Century mod 4 || Century mod 7||'''c'''
| |
| |-
| |
| | ('''17'''00, '''21'''00) 1 || ('''14'''00, '''07'''00) 0 || '''4'''
| |
| |-
| |
| | || ('''15'''00, '''08'''00) 1 || '''3'''
| |
| |-
| |
| | ('''18'''00, '''22'''00) 2 || ('''16'''00, '''09'''00) 2|| '''2'''
| |
| |-
| |
| | || ('''17'''00, '''10'''00) 3 || '''1'''
| |
| |-
| |
| | ('''19'''00, '''23'''00) 3|| ('''18'''00, '''11'''00) 4 || '''0'''
| |
| |-
| |
| | ('''20'''00, '''24'''00) 0 || ('''12'''00, '''05'''00) 5 || '''6'''
| |
| |-
| |
| | || ('''13'''00, '''06'''00) 6|| '''5'''
| |
| |}
| |
| | |
| ===Complete table===
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| ! colspan="1"| Date || <span style="background-color:#FFFF88">01</span>|| 02|| 03|| 04|| 05|| 06|| 07
| |
| |-
| |
| ! colspan="1"| || 08|| 09|| 10 ||11|| 12|| 13|| 14
| |
| |-
| |
| ! colspan="1"| || 15|| 16|| 17|| 18 ||19|| 20|| 21
| |
| |-
| |
| ! colspan="1"| || 22|| 23|| 24|| 25|| 26|| 27|| 28
| |
| |-
| |
| ! colspan="1"| Month || 29 ||30 ||31 || || || ||
| |
| ! colspan="5"| Year modulo 28
| |
| ! colspan="2"|Century mod 4
| |
| ! colspan="2"| Century mod 7
| |
| |-
| |
| ! colspan="1"| 4 {{0}}7 || Sun ||Mon ||Tue ||Wed ||Thu ||Fri || <span style="background-color:#88FF88">Sat</span> ||01 ||07 ||12 ||18 ||''24'' || '''16'''00{{0}} <span style="background-color:#88FF88">'''20'''</span>00 ||<span style="background-color:#88FF88">'''0'''</span> || '''05'''00 {{0}}'''12'''00 ||'''5'''
| |
| |-
| |
| ! colspan="1"| 9 {{0}}12 || Sat ||Sun ||Mon ||Tue ||Wed ||Thu ||Fri ||02 ||''08'' ||13 ||19 ||24
| |
| ! colspan="2"| || '''06'''00 {{0}}'''13'''00 ||'''6'''
| |
| |-
| |
| ! colspan="1"| 6 || Fri || Sat ||<span style="background-color:#BBBBFF">Sun</span> ||Mon ||Tue ||Wed ||Thu ||03 ||08 ||14 ||''20'' ||25 || '''17'''00 {{0}}'''<span style="background-color:#BBBBFF">21</span>'''00 ||'''<span style="background-color:#BBBBFF">1</span>''' || '''07'''00 {{0}}'''14'''00 ||'''0'''
| |
| |-
| |
| ! colspan="1"| 2{{0}} 3 {{0}}11 || Thu || Fri || <span style="background-color:#BBBBFF">Sat</span> ||Sun ||Mon ||Tue ||Wed || ''04'' ||09 ||<span style="background-color:#BBBBFF">15</span> ||20 ||26
| |
| ! colspan="2"| || '''08'''00{{0}} '''15'''00 ||'''1'''
| |
| |-
| |
| ! colspan="1"| 8 || Wed ||Thu || Fri || Sat ||Sun ||Mon ||Tue || 04 ||10 ||''16'' ||21 ||27 || '''18'''00 {{0}}'''22'''00 ||'''2''' || '''09'''00 {{0}}'''02'''00 ||'''2'''
| |
| |-
| |
| ! colspan="1"| 5 || Tue|| Wed ||Thu || Fri || Sat ||Sun || <span style="background-color:#FF8888">Mon</span> ||05 ||11 ||16 || 22|| ''<span style="background-color:#FF8888">00</span>''
| |
| ! colspan="2"| || '''10'''00{{0}} '''03'''00 ||'''3'''
| |
| |-
| |
| ! colspan="1"| <span style="background-color:#FFFF88">1</span>{{0}} 10 || <span style="background-color:#FFFF88">Mon</span> || Tue|| <span style="background-color:#BBBBFF">Wed</span> ||Thu || Fri || Sat ||Sun || 06 ||''12''|| 17|| 23|| <span style="background-color:#BBBBFF">00</span>|| '''19'''00 {{0}}'''23'''00|| '''3''' || '''11'''00 {{0}}'''04'''00|| '''4'''
| |
| |}
| |
| For determination of the day of the week (January 1, 2000, Saturday)
| |
| *<span style="background-color:#FFFF88">the day of the month: 1 ~ 31 (1)</span>
| |
| *<span style="background-color:#FFFF88">the month: 1 for January ~ 12 for December (1,Mon) </span>
| |
| *<span style="background-color:#FF8888">the year: 00 ~ 99 mod 28 and italic for January or February in leap years (''00'' ~ Mon)</span>
| |
| *<span style="background-color:#88FF88">the century mod 4 for the Gregorian calendar and mod 7 for the Julian calendar (20 or 0 ~ Sat)</span>.
| |
| For determination of the dominical letter of a year (2100 C ~ 2199 F)
| |
| *<span style="background-color:#BBBBFF">the century column: from the century row to Sun which is in the column and in the row (21 or 1)</span>
| |
| *<span style="background-color:#BBBBFF">the dominical letter: Mon for A ~ Sun for G from the year row to the century column (00 ~ Wed for C, 15 for 99 ~ Sat for F)</span>.
| |
| | |
| For the Gregorian date of January 1, 2000 (a leap year):
| |
| *The day of the month: 1
| |
| *January in the months table: 6
| |
| *Last two digits of year (divided by 4): 0
| |
| *Century number: 6
| |
| The result is 13, leaving a remainder of 6 when divided by 7, so January 1, 2000 was a Saturday.
| |
| | |
| For the Julian date of October 13, 1307:
| |
| *The day of the month: 13
| |
| *October in the months table: 0
| |
| *Last two digits of year divided by 4: 1
| |
| *Last two digits of year: 7
| |
| *Century number: 5
| |
| The result is 26, leaving a remainder of 5 when divided by 7, so October 13, 1307 was a Friday.
| |
| | |
| ==Gauss's algorithm==
| |
| In a handwritten note in a collection of astronomical tables, [[Carl Friedrich Gauss]] described a method for calculating the day of the week for the first of January in any given year.<ref name=Gauss>{{cite book|last=Gauss|first=Carl F.|chapter=Den Wochentag des 1. Januar eines Jahres zu finden. Güldene Zahl. Epakte. Ostergrenze.|title=Werke. herausgegeben von der Königlichen Gesellschaft der Wissenschaften zu Göttingen.|year=1981|publisher=Georg Olms Verlag|location=Hildesheim|isbn=9783487046433|pages=206–207|edition=2. Nachdruckaufl.}}</ref> He never published it. It was finally included in his collected works in 1927.<ref name=Schwerdtfeger>{{cite web |first=Berndt E. |last=Schwerdtfeger |title=Gauss' calendar formula for the day of the week |edition = 1.4.26 |date=May 7, 2010 |format=pdf |url=http://berndt-schwerdtfeger.de/cal/cal.pdf |accessdate=23 December 2012}}</ref>
| |
| | |
| Gauss's method was applicable to the Gregorian calendar. He numbered the weekdays from 0 to 6 starting with Sunday. He defined the following operation:
| |
| The weekday of the first of January in year number {{math|''A''}} is<ref name=Gauss/>
| |
| :<math> R(1 + 5R((A-1),4) + 4R((A-1),100) + 6R((A-1),400),7)</math>
| |
| where {{math|''R(y,m)''}} is the [[remainder]] after division of {{math|''y''}} by {{math|''m''}},<ref name=Schwerdtfeger/> or {{math|''y''}} modulo {{math|''m''}}.
| |
| | |
| This formula was also converted into tabular methods for calculating any day of the week by Kraitchik and Schwerdtfeger.<ref name=Schwerdtfeger/><ref name=Kraitchik>{{cite book|last=Kraitchik|first=Maurice|chapter=Chapter five: The calendar |title=Mathematical recreations|year=1942|publisher=Dover Publications|location=Mineola|isbn=9780486453583|edition=2nd rev. [Dover] |pages=109–116}}</ref>
| |
| | |
| ===Formulas derived from Gauss's algorithm===
| |
| | |
| The Gauss formula for January 1 can be converted into methods for calculating the day of the week for any given date as follows.
| |
| | |
| *For the Gregorian calendar
| |
| :Let A - 1 = year = Y, m = month - 2 mod 12 (March = 1,..., January = -1 mod 12 = 11 and February = 12) and d = days of the month, this formula becomes
| |
| :<math> w = d + [2.6m - 0.2] + 5R(Y,4) + 4R(Y,100) + 6R(Y,400) \mod 7. </math>
| |
| :Let A - 1 = year = y + 100c, this formula becomes
| |
| :<math> w = d + [2.6m - 0.2] + 5R(y,4) + 3R(y,7) + 5R(c,4) \mod 7. </math>
| |
| *For the Julian calendar
| |
| :<math> w = d + [2.6m - 2.2] + 5R(Y,4) + 3R(Y,7) \mod 7 </math>
| |
| :<math> w = d + [2.6m - 2.2] + 5R(y,4) + 3R(y,7) + 6R(c,7) \mod 7 </math>
| |
| *Note: year - 1 for January and February.
| |
| :For January 1, 2000, the date would be treated as the 11th month of 1999,
| |
| ::d = 1
| |
| ::[2.6 × 11 - 0.2] = 28 mod 7 = 0
| |
| ::5R(99,4) = 5 × 3 = 15 mod 7 = 1
| |
| ::4R(1999,100) = 4 × 99 mod 7 = 4 × 1 = 4
| |
| ::6R(1999,400) = 6 × 399 mod 7 = 6 × 0 = 0
| |
| ::3R(99,7) = 3 × 1 = 3
| |
| ::5R(19,4) = 5 × 3 mod 7 = 1
| |
| ::w = 1 + 0 + 1 + 4 + 0 = 1 + 0 + 1 + 3 + 1 = 6 = Saturday.
| |
| :For December 31, 2000, the date would be treated as the 10th month of the year,
| |
| ::d = 31 mod 7 = 3
| |
| ::[2.6 × 10 - 0.2] = 25 mod 7 = 4
| |
| ::5R(00,4) = 5 × 0 = 0
| |
| ::4R(2000,100) = 4 × 0 = 0
| |
| ::6R(2000,400) = 6 × 0 = 0
| |
| ::3R(00,7) = 3 × 0 = 0
| |
| ::5R(20,4) = 5 × 0 = 0
| |
| ::w = 3 + 4 + 0 + 0 + 0 = 3 + 4 + 0 + 0 + 0 = 7 mod 7 = 0 = Sunday.
| |
| :For April 30, 1777, the date would be treated as the second month of the year,
| |
| ::d = 30 mod 7 = 2
| |
| ::[2.6 × 2 - 0.2] = 5
| |
| ::5R(77,4) = 5 × 1 = 5
| |
| ::4R(1777,100) = 4 × 77 mod 7 = 0
| |
| ::6R(1777,400) = 6 × 177 mod 7 = 6 × 2 mod 7 = 5
| |
| ::3R(77,7) = 3 × 0 = 0
| |
| ::5R(17,4) = 5 × 1 = 5
| |
| ::w = 2 + 5 + 5 + 0 + 5 = 17 mod 7 = 3 = Wednesday.
| |
| :For October 4, 1582, the date would be treated as the 8th month of the year,
| |
| ::d = 4
| |
| ::[2.6 × 8 – 2.2] = 4
| |
| ::5R(82,4) = 5 × 2 mod 7 = 3
| |
| ::3R(1582, 7) = 3 × 0 = 0
| |
| ::3R(82,7) = 3 × 5 mod 7 = 1
| |
| ::6R(15,7) = 6 × 1 = 6
| |
| ::w = 4 + 4 + 3 + 0 mod 7 = 4 + 4 + 3 + 1 + 6 mod 7 = 4 = Thursday.
| |
| :For January 1, 00 (BC 1), the date would be treated as the 11th month of the previous year,
| |
| ::d = 1
| |
| ::[2.6 × 11 – 2.2] = 5
| |
| ::5R(-1,4) = 5 × 3 mod 7 = 1
| |
| ::3R(-1,7) = 3 × 6 mod 7 = 4
| |
| ::3R(-1,7) = 3 × 6 mod 7 = 4
| |
| ::6R(0,7) = 6 × 0 = 0
| |
| ::w = 1 + 5 + 1 + 4 mod 7 = 1 + 5 + 1 + 4 + 0 mod 7 = 4 = Thursday.
| |
| | |
| ===Kraitchik's algorithm===
| |
| | |
| Kraitchik proposed two methods for calculating the day of the week.<ref name=Kraitchik/> One is a graphical method. The other uses the formula
| |
| :<math>w = d + m + c + y \mod 7,</math>
| |
| where {{math|''w''}} is the day of the week (counting upwards from 1 on Sunday instead of 0 in Gauss's version); and {{math|''m''}}, {{math|''c''}} and {{math|''y''}} are numbers depending on the month, day and year as in the following tables:
| |
| | |
| {| border="1" class="wikitable"
| |
| |-
| |
| |Month || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12
| |
| |-
| |
| ! colspan="1"|{{math|''m''}} || 1 || 4 || 3 || 6 || 1 || 4 || 6 || 2 || 5 || 0 || 3 || 5
| |
| |}
| |
| | |
| For the Gregorian calendar,
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| |[Year/100] mod 4 || 0 || 1 || 2 || 3
| |
| |-
| |
| ! colspan="1"|{{math|''c''}} || 0 || 5 || 3 || 1
| |
| |}
| |
| For the Julian calendar,
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| |[Year/100] mod 7 || 0 || 1 || 2 || 3 || 4 || 5 || 6
| |
| |-
| |
| ! colspan="1"|{{math|''c''}} || 5 || 4 || 3 || 2 || 1 || 0 || 6
| |
| |}
| |
| | |
| Finally, the year number is obtained from this table:
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| ! colspan="18" | Last two digits of the year
| |
| ! |'''y'''
| |
| |-
| |
| | 00 || 06 || || 17 || 23 || 28 || 34 || || 45 || 51 || 56 || 62 || || 73 || 79 || 84 || 90 || || '''0'''
| |
| |-
| |
| | 01 || 07 || 12 || 18 || || 29 || 35 || 40 || 46 || || 57 || 63 || 68 || 74 || || 85 || 91 || 96 || '''1'''
| |
| |-
| |
| | 02 || || 13 || 19 || 24 || 30 || || 41 || 47 || 52 || 58 || || 69 || 75 || 80 || 86 || || 97 || '''2'''
| |
| |-
| |
| | 03 || 08 || 14 || || 25 || 31 || 36 || 42 || || 53 || 59 || 64 || 70 || || 81 || 87 || 92 || 98 || '''3'''
| |
| |-
| |
| | || 09 || 15 || 20 || 26 || || 37 || 43 || 48 || 54 || || 65 || 71 || 76 || 82 || || 93 || 99 || '''4'''
| |
| |-
| |
| | 04 || 10 || || 21 || 27 || 32 || 38 || || 49 || 55 || 60 || 66 || || 77 || 83 || 88 || 94 || || '''5'''
| |
| |-
| |
| | 05 || 11 || 16 || 22 || || 33 || 39 || 44 || 50 || || 61 || 67 || 72 || 78 || || 89 || 95 || || '''6'''
| |
| |}
| |
| | |
| ===Schwerdtfeger's variation===
| |
| In the version by Schwerdtfeger, the year is split into the century and the two digit year within the century. The approach depends on the month. For {{math|<var>m</var> ≥ 3}},
| |
| :<math> c = \left\lfloor\frac{y}{100}\right\rfloor \quad \text{and} \quad g = y - 100 c,</math>
| |
| so {{math|<var>g</var>}} is between 0 and 99. For {{math|<var>m</var> {{=}} 1,2}},
| |
| :<math> c = \left\lfloor\frac{y-1}{100}\right\rfloor \quad \text{and} \quad g = y - 1 - 100 c.</math>
| |
| The formula for the day of the week is<ref name=Schwerdtfeger/>
| |
| :<math> w = d + e + f + g + \left\lfloor\frac{g}{4}\right\rfloor \mod 7,</math>
| |
| where the positive modulus is chosen.<ref name=Schwerdtfeger/>
| |
| | |
| The value of {{math|''e''}} is obtained from the following table:
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| |{{math|''m''}} || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12
| |
| |-
| |
| |{{math|''e''}} || 0 || 3 || 2 || 5 || 0 || 3 || 5 || 1 || 4 || 6 || 2 || 4
| |
| |}
| |
| | |
| The value of {{math|''f''}} is obtained from the following table, which depends on the calendar. For the Gregorian calendar,<ref name=Schwerdtfeger/>
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| |{{math|''c'' mod 4}} || 0 || 1 || 2 || 3
| |
| |-
| |
| ! colspan="1"|{{math|''f''}} || 0 || 5 || 3 || 1
| |
| |}
| |
| For the Julian calendar,<ref name=Schwerdtfeger/>
| |
| {| border="1" class="wikitable"
| |
| |-
| |
| |{{math|''c'' mod 7}} || 0 || 1 || 2 || 3 || 4 || 5 || 6
| |
| |-
| |
| ! colspan="1"|{{math|''f''}} || 5 || 4 || 3 || 2 || 1 || 0 || 6
| |
| |}
| |
| | |
| ===Other variations===
| |
| Another variation of the above algorithm works with fewer lookup tables. A slight disadvantage is the unusual month and year counting convention. The formula is
| |
| | |
| : <math>w = (d + \lfloor 2.6m - 0.2 \rfloor + y + \left\lfloor\frac{y}{4}\right\rfloor + \left\lfloor\frac{c}{4}\right\rfloor - 2c)\ \bmod\ 7,</math>
| |
| | |
| where
| |
| ''Y'' is the year minus 1 for January or February, and the year for the rest of the year
| |
| ''y'' is the last 2 digits of Y
| |
| ''c'' is the first 2 digits of Y
| |
| ''d'' is the day of the month (1 to 31)
| |
| ''m'' is the shifted month (March=1,...February=12)
| |
| ''w'' is the day of week (0=Sunday,..6=Saturday)
| |
| | |
| For example, January 1, 2000.(year-1 for January)
| |
| *<math>w = (1 + \lfloor 2.6 \cdot 11 - 0.2 \rfloor + (0 - 1) + \left\lfloor\frac{0 - 1}{4}\right\rfloor + \left\lfloor\frac{20}{4}\right\rfloor - 2 * 20)\ \bmod\ 7</math> <math> = (1 + 28 - 1 -1 + 5 - 40)\ \bmod\ 7 = 6 = Saturday</math>
| |
| | |
| *<math>w = (1 + \lfloor 2.6 \cdot 11 - 0.2 \rfloor + (100 - 1) + \left\lfloor\frac{100 - 1}{4}\right\rfloor + \left\lfloor\frac{20 - 1}{4}\right\rfloor - 2 * (20 - 1)\ \bmod\ 7</math> <math> = (1 + 28 +99 + 24 + 4 - 38)\ \bmod\ 7 = 6 = Saturday</math>
| |
| Note: The first is only for a 00 leap year and the second is for any 00 years.
| |
| | |
| The term '''[2.6m - 0.2]''' mod 7 gives the values of months: m
| |
| '''Months m'''
| |
| January 0
| |
| February 3
| |
| March 2
| |
| April 5
| |
| May 0
| |
| June 3
| |
| July 5
| |
| August 1
| |
| September 4
| |
| October 6
| |
| November 2
| |
| December 4
| |
| | |
| The term '''y + [y/4]''' mod 7 gives the values of years: y
| |
| | |
| '''Y mod 28 y'''
| |
| 01 07 12 18–1
| |
| 02 -– 13 19 24 2
| |
| 03 08 14 –- 25 3
| |
| -- 09 15 20 26 4
| |
| 04 10 –- 21 27 5
| |
| 05 11 16 22 –- 6
| |
| 06 -– 17 23 00 0
| |
| | |
| The term '''[c/4] - 2c''' mod 7 gives the values of centuries: c
| |
| | |
| '''C mod 4 c'''
| |
| 1 5
| |
| 2 3
| |
| 3 1
| |
| 0 0
| |
| | |
| Now from the general formula: <math>w = d + m + y +c \ \bmod\ 7</math>; January 1, 2000 can be recalculated as follows:
| |
| | |
| *<math>w = 1 + 0 + 5 + 0 \ \bmod\ 7 = 6 = Saturday</math>, d = 1, m = 0, y = 5 (0 - 1 mod 28 = 27), c = 0 (20 mod 4 = 0)
| |
| | |
| *<math>w = 1 + 0 + 4 + 1 \ \bmod\ 7 = 6 = Saturday</math>, d = 1, m = 0, y = 4 (99 mod 28 = 15), c = 1 (20 - 1 mod 4 = 3)
| |
| | |
| ==Other purely mathematical algorithms==
| |
| | |
| ===Zeller’s algorithm===
| |
| {{main|Zeller's congruence}}
| |
| In Zeller’s algorithm, the months are numbered from 3 for March to 14 for February. The year is assumed to begin in March; this means, for example, that January 1995 is to be treated as month 13 of 1994.<ref>{{cite web |url=http://www.merlyn.demon.co.uk/zeller-c.htm#Alg |title=The Calendrical Works of Rektor Chr. Zeller : The Day-of-Week and Easter Formulae |work=Merlyn |author=J. R. Stockton |date=19 March 2010 |accessdate=19 December 2012}}</ref>
| |
| The formula for the Gregorian calendar is <br />
| |
| :<math> w = (d + [(m + 1)2.6] + y +[y/4] + [c/4] - 2c)\ \bmod\ 7</math>
| |
| where
| |
| ''Y'' is the year minus 1 for January or February, and the year for the rest of the year
| |
| ''y'' is the last 2 digits of Y
| |
| ''c'' is the first 2 digits of Y
| |
| ''d'' is the day of the month (1 to 31)
| |
| ''m'' is the shifted month (March=3,...February=14)
| |
| ''w'' is the day of week (1=Sunday,..0=Saturday)
| |
| The only difference is one between Zeller’s algorithm (Z) and Gaussian algorithm (G), that is Z - G = 1 = Sunday.
| |
| :<math> (d + [(m + 1)2.6] + y +[y/4] + [c/4] - 2c)\ \bmod\ 7 - (d + [2.6m - 0.2] + y +[y/4] + [c/4] - 2c)\ \bmod\ 7</math>
| |
| <math> = ([(m + 2 + 1)2.6 - (2.6m - 0.2)])\ \bmod\ 7 </math> (March=3 in Z but March=1 in G)<br /><math> = ([2.6m + 7.8 - 2.6m + 0.2])\ \bmod\ 7</math><br /><math>= 8 \ \bmod\ 7 = 1</math><br />
| |
| So we can get the values of months from those for Gaussian algorithm by adding one:
| |
| '''Months m'''
| |
| January 1
| |
| February 4
| |
| March 3
| |
| April 6
| |
| May 1
| |
| June 4
| |
| July 6
| |
| August 2
| |
| September 5
| |
| October 0
| |
| November 3
| |
| December 5
| |
| | |
| ===Tøndering's algorithm===
| |
| Claus Tøndering's algorithm uses a variant of the method of congruence used by Gauss, thereby shifting month-numbers by the same amount, and arriving at
| |
| the same adjustment for a given month. It differs from the rest of the Gaussian algorithm by not splitting off the nominal century from the year, and by
| |
| dividing itself into separate equations - the last being equivalent term-for-term to the expression used in Sakamoto's method to calculate the day of
| |
| the week.<ref>{{cite web |title=What day of the week was 2 August 1953? |url=http://www.tondering.dk/claus/cal/chrweek.php#calcdow |work=The Calendar FAQ |first=Claus |last=Tøndering |accessdate=19 December 2012}}</ref>
| |
| | |
| ==Other methods (using tables or computational devices)==
| |
| | |
| ===Lewis Carroll's method===
| |
| Charles Lutwidge Dodgson ([[Lewis Carroll]]) devised a method resembling a puzzle, yet partly the same as the tabular method given above: he lists the same three adjustments for the first three months, one 7 higher for the last, and gives cryptic instructions for finding the rest; his adjustments for centuries are to be determined using formulas identical to those for the centuries table. Although claiming to use a modification for [[Old Style]] dates, the one he uses to determine that "1676, February 23" is a Wednesday, only works on the New Style Julian calendar.<ref>Lewis Carroll, "To Find the Day of the Week for Any Given Date", Nature, March 31, 1887.</ref><ref>Martin Gardner, "The Universe in a Handkerchief: Lewis Carroll's Mathematical Recreations, Games, Puzzles, and Word Plays", pages 24-26, Springer-Verlag, 1996</ref>
| |
| | |
| '''Algorithm:'''
| |
| Take the given date in 4 portions, viz. the number of centuries, the number of years over, the month, the day of the month.
| |
| Compute the following 4 items, adding each, when found, to the total of the previous items. When an item or total exceeds 7, divide by 7, and keep the remainder only.
| |
| | |
| The Century-item For Old Style (which ended September 2, 1752) subtract from 18. For New Style (which began September 14) divide by 4, take overplus from 3, multiply remainder by 2.
| |
| | |
| The Year-item Add together the number of dozens, the overplus, and the number of 4s in the overplus.
| |
| | |
| The Month-item If it begins or ends with a vowel, subtract the number, denoting its place in the year, from 10. This, plus its number of days, gives the item for the following month. The item for January is "0"; for February or March, "3"; for December, "12".
| |
| | |
| The Day-item The total, thus reached, must be corrected, by deducting "1" (first adding 7, if the total be "0"), if the date be January or February in a leap year: remembering that every year, divisible by 4, is a Leap Year, excepting only the century-years, in New Style, when the number of centuries is not so divisible (e.g. 1800).
| |
| | |
| The final result gives the day of the week, "0" meaning Sunday, "1" Monday, and so on.
| |
| | |
| '''Examples:'''
| |
| | |
| :''1783, September 18''
| |
| 17, divided by 4, leaves "1" over; 1 from 3 gives "2"; twice 2 is "4".
| |
| 83 is 6 dozen and 11, giving 17; plus 2 gives 19, i.e. (dividing by 7) "5". Total 9, i.e. "2"
| |
| The item for August is "8 from 10", i.e. "2"; so, for September, it is "2 plus 31", i.e. "5" Total 7, i.e. "0", which goes out.
| |
| 18 gives "4". Answer, "Thursday".
| |
| :''1676, February 23''
| |
| 16 from 18 gives "2"
| |
| 76 is 6 dozen and 4, giving 10; plus 1 gives 11, i.e. "4".
| |
| Total "6"
| |
| The item for February is "3". Total 9, i.e. "2"
| |
| 23 gives "2". Total "4"
| |
| Correction for Leap Year gives "3". Answer, "Wednesday"
| |
| | |
| ===Implementation-dependent methods of Sakamoto, Lachman, Keith and Craver===
| |
| | |
| In the [[C language]] expressions below, <tt>y</tt>, <tt>m</tt> and <tt>d</tt> are, respectively, integer variables representing the year (e.g.,
| |
| 1988), month (1-12) and day of the month (1-31).
| |
| <tt>
| |
| (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7 </tt>
| |
| In 1990, Michael Keith and Tom Craver published the foregoing expression that seeks to minimise the number of keystrokes needed to enter a
| |
| self-contained function for converting a Gregorian date into a numerical day of the week.<ref>
| |
| Michael Keith and Tom Craver. (1990). ''The ultimate perpetual calendar?'', Journal of Recreational Mathematics, 22:4, pp.280-282.
| |
| </ref> It preserves neither <tt>y</tt> nor <tt>d</tt>, and returns <tt>0</tt> = Sunday, <tt>1</tt> = Monday, etc.
| |
|
| |
| Shortly afterwards, Hans Lachman streamlined their algorithm for ease of use on low-end devices. As designed originally for four-function calculators, his method needs fewer keypad entries by limiting its range either to A.D. 1905-2099, or to historical Julian dates. It was later modified to convert any Gregorian date, even on an [[abacus]]. On Motorola [[68000]]-based devices, there is similarly less need of either [[processor registers]] or [[opcodes]].
| |
| | |
| The tabular forerunner to Tøndering's algorithm is embodied in the following [[ANSI C]] function. With minor changes, it is adaptable to other [[high level programming language]]s such as [[APL2]]. (A [[6502]] [[assembly language]] version exists as well.) Devised by Tomohiko Sakamoto in 1993, it is accurate for any Gregorian date:
| |
| | |
| <tt>
| |
| int dow(int y, int m, int d)
| |
| {
| |
| static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
| |
| y -= m < 3;
| |
| return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
| |
| }</tt>
| |
| | |
| The function does not always preserve <tt>y</tt>, and returns <tt>0</tt> = Sunday, <tt>1</tt> = Monday, etc.
| |
| | |
| ===Babwani's method=== | |
| Sohael Babwani developed an alternative method that enables one not only to find the day of the week but also a date, when the day, month and year are
| |
| given.<ref>Sohael Babwani (2004). ''An extended approach to the Julian and the Gregorian calendar'', The Mathematical Gazette, 88:77, pp.
| |
| 569–573.</ref> It uses a months table in a manner identical to the one above, and numbers months normally from 1 for January to 12 for
| |
| December.<ref>[http://babwani-congruence.blogspot.com/2009/08/frequently-asked-questions_11.html Calculating the day of the week and much more: Frequently Asked Questions<!-- Bot generated title -->]</ref>
| |
| | |
| ==See also==
| |
| {{portal|Time}}
| |
| *[[Doomsday rule]]
| |
| *[[Julian day#Calculation]]
| |
| *[[Mental Calculation World Cup]] (Has a calendar calculation contest)
| |
| *[[Perpetual calendar]]
| |
| *[[Perpetual Calendar of 800 Years]]
| |
| | |
| ==References==
| |
| {{reflist}}
| |
| {{Refbegin}}
| |
| *{{cite book|last=Gauss|first=Carl F.|chapter=Den Wochentag des 1. Januar eines Jahres zu finden. Güldene Zahl. Epakte. Ostergrenze.|title=Werke. herausgegeben von der Königlichen Gesellschaft der Wissenschaften zu Göttingen.|year=1981|publisher=Georg Olms Verlag|location=Hildesheim|isbn=9783487046433|pages=206–207|edition=2. Nachdruckaufl.}}
| |
| *{{cite book|last=Hale-Evans|first=Ron|chapter=Hack #43: Calculate any weekday |title=Mind performance hacks|year=2006|publisher=O'Reilly|location=Beijing|isbn=9780596101534|pages=164–169|edition=1st}}
| |
| *{{cite journal|last=Thioux|first=Marc|coauthors=Stark, David E.; Klaiman, Cheryl; Schultz, Robert T.|title=The day of the week when you were born in 700 ms: Calendar computation in an autistic savant.|journal=Journal of Experimental Psychology: Human Perception and Performance|year=2006|volume=32|issue=5|pages=1155–1168|doi=10.1037/0096-1523.32.5.1155}}
| |
| *{{cite book|last=Treffert|first=Darold A.|title=Islands of genius : the bountiful mind of the autistic, acquired, and sudden savant|publisher=Jessica Kingsley|location=London|isbn=9781849058735|chapter=Why calendar calculating?|pages=63–66|edition=1. publ., [repr.].}}
| |
| {{Refend}}
| |
| | |
| ==External links==
| |
| *[http://katzentier.de/_misc/perpetual_calendar.htm Compact tabular method for memorization, also for the Julian calendar]
| |
| *[http://www.tondering.dk/claus/cal/chrweek.php#calcdow An algorithm for both Gregorian and Julian calendars]
| |
| *[http://www.tondering.dk/claus/cal/gregorian.php#country When countries changed from the Julian calendar]
| |
| * [http://www.recordholders.org/en/records/dates.html World records for mentally calculating the day of the week in the Gregorian calendar ]
| |
| * [http://calculatingday.blogspot.fr/p/easy-method-for-calculating-dates-day.html A recent reworking of the method of Keith & Craver eliminating the need to recall a value for each year.]
| |
| * [https://play.google.com/store/apps/details?id=com.goltzkiste.guessaday A trainer for mental calculation of the day of the week]
| |
| | |
| {{Time measurement and standards}}
| |
| | |
| [[Category:Days of the week]]
| |
| [[Category:Gregorian calendar]]
| |
| [[Category:Julian calendar]]
| |
| [[Category:Calendar algorithms]]
| |