JP2000122998A - Method and device for calculating day of week - Google Patents

Method and device for calculating day of week

Info

Publication number
JP2000122998A
JP2000122998A JP10291782A JP29178298A JP2000122998A JP 2000122998 A JP2000122998 A JP 2000122998A JP 10291782 A JP10291782 A JP 10291782A JP 29178298 A JP29178298 A JP 29178298A JP 2000122998 A JP2000122998 A JP 2000122998A
Authority
JP
Japan
Prior art keywords
day
year
remainder
leap
week
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP10291782A
Other languages
Japanese (ja)
Inventor
Shinji Otake
信二 大竹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Victor Company of Japan Ltd
Original Assignee
Victor Company of Japan Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Victor Company of Japan Ltd filed Critical Victor Company of Japan Ltd
Priority to JP10291782A priority Critical patent/JP2000122998A/en
Publication of JP2000122998A publication Critical patent/JP2000122998A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

PROBLEM TO BE SOLVED: To reduce the scale of a circuit by reducing the scale of operation for calculating a day of the week. SOLUTION: In the day-of-week calculation method, the A.D. year of a required date is divided by 400, an obtained remainder E, the number U of intercalary years of the year having the remainder E, an intercalary year addition day L to be '1' when the required date is an intercalary year or '0' when the required date is not an intercalary year, the number F of days from January 1 to the end of the preceding month of the required month, and a required day C are added, and a remainder obtained at the time of dividing the added value by '7' is used for a day-of-week conversion table.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、紀元後の西暦(グ
レゴリオ暦)における任意の年月日に対応する曜日を算
出するための曜日算出方法及び曜日算出装置に関するも
のである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a day calculation method and a day calculation device for calculating a day corresponding to an arbitrary date in the Christian era (Gregorian calendar).

【0002】[0002]

【従来の技術】従来から、ある特定の年月日(例えばA
年B月C日)に対応する曜日を算出する場合、基準日
(例えば1900年1月1日)とその曜日(日曜日)を
事前に設定し、その基準日からA年B月C日までの日数
を算出して、この日数を7で除算したときの余りによっ
て曜日を算出していた。
2. Description of the Related Art Conventionally, a specific date (for example, A
When calculating the day of the week corresponding to the month B / C), a reference date (for example, January 1, 1900) and the day of the week (Sunday) are set in advance, and the date from the reference date to the date B / C of the year A is calculated. The number of days was calculated, and the day of the week was calculated by the remainder when dividing the number of days by 7.

【0003】[0003]

【発明が解決しようとする課題】上述した従来の曜日算
出方法では、基準日以前の日付については算出不可能で
あり、基準日以前の年月日について、その曜日を知りた
い場合などに対応ができなかった。また、基準日を設定
する場合に、同じにその基準日の曜日の設定も必要とな
り、その基準日の曜日がいつであるかという調査が必要
であった。
With the above-described conventional day-of-the-week calculation method, it is impossible to calculate a date before the reference date. could not. Also, when setting a reference date, it is necessary to set a day of the week of the reference day, and it is necessary to investigate when the day of the reference day is.

【0004】更に、基準日から日付を算出するために基
準日から所望の年までの年数に365を乗じる必要があ
り、その演算結果が大きくなって回路の規模が大きくな
ってしまうという課題があった。
Further, in order to calculate a date from a reference date, it is necessary to multiply the number of years from the reference date to a desired year by 365, and there is a problem that the calculation result becomes large and the circuit scale becomes large. Was.

【0005】[0005]

【課題を解決するための手段】本発明は上述した課題を
解決するために、所望の西暦A年B月C日に対して、そ
の曜日を算出する曜日算出方法であって、その年Aを4
00で除算し第1の余りEを算出するステップと、前記
A年の前年までの閏年の数(第1の余りE年間)Uを算
出するステップと、前記第1の余りEを2進数で表記し
たときに下位2ビットが00になり、前記第1の余りE
が100、200、300のいずれでもないときに前記
A年が閏年であると判別するステップと、前記A年が閏
年であるときに、前記B月が3以上であるときに閏年加
算日Lを1とし、前記B月が2以下であるときに閏年加
算日Lを0とするステップと、1月1日から所望の月B
の前月の末日までの日数Fを調べるステップと、前記第
1の余りEと、前記閏年の数Uと、前記閏年加算日L
と、日数Fと、所望の日である日Cを加算してその和M
を演算するステップと、前記和Mを7で除算して得られ
た第2の余りNを曜日算出テーブルに適用することで曜
日を算出するステップとからなる曜日算出方法を提供す
るものである。
SUMMARY OF THE INVENTION In order to solve the above-mentioned problems, the present invention provides a day-of-week calculating method for calculating a desired day of the week on B / C of the year A. 4
Calculating a first remainder E by dividing by 00; calculating the number U of leap years up to the previous year of the A year (first remainder E years); and dividing the first remainder E by a binary number. When written, the lower two bits become 00, and the first remainder E
Is not 100, 200, or 300, the step of determining that the year A is a leap year, and when the year A is a leap year, the leap year addition date L is set when the month B is 3 or more. Setting the leap year addition day L to 0 when the B month is 2 or less; and setting a desired month B from January 1
Checking the number of days F until the last day of the previous month, the first remainder E, the number U of leap years, and the leap year addition date L
, The number of days F and the desired day C, and the sum M
And calculating a day of the week by applying a second remainder N obtained by dividing the sum M by 7 to a day of week calculation table.

【0006】また、所望の西暦A年B月C日に対して、
その曜日を算出する曜日算出装置であって、Aを400
で除算して第1の余りEを算出する手段1と、前記A年
の前年までの閏年の数(第1の余りE年間)Uを算出す
る手段2と、前記第1の余りE及び所望の月Bより所望
の西暦A年B月C日が閏年であるかを判別し、閏年であ
るときには閏年加算日Lを1とし、閏年ではないときに
は閏年加算日Lを0として出力する手段3と、1月1日
から所望の月Bの前月の末日までの日数Fを出力する手
段4と、前記第1の余りEと、前記閏年の数Uと、前記
閏年加算日Lと、日数Fと、所望の日である日Cを加算
してその和Mを演算する手段5と、前記和Mを7で除算
して得られた第2の余りNを曜日算出テーブルに適用す
ることで曜日を算出する手段とからなる曜日算出装置を
提供するものである。
[0006] Also, with respect to the desired date B / C / A,
A day calculating device for calculating the day, wherein A is 400
Means 1 for calculating the first remainder E by dividing by E, means 2 for calculating the number of leap years (first remainder E years) U up to the previous year of A, the first remainder E and the desired Means 3 for judging whether a desired year A, B, and C of the year B is a leap year from month B of the month B, and sets leap year addition day L to 1 if it is a leap year, and outputs leap year addition day L as 0 if it is not a leap year. Means 4 for outputting the number of days F from January 1 to the last day of the month preceding the desired month B, the first remainder E, the number U of leap years, the date L of leap years added, the number of days F, Means 5 for adding the day C, which is a desired day, to calculate the sum M, and applying the second remainder N obtained by dividing the sum M by 7 to the day of the week calculation table to determine the day of the week. The present invention provides a day-of-the-week calculation device including means for calculating.

【0007】[0007]

【発明の実施の形態】曜日は7日周期で変化しており、
閏年を除く通常の1年の日数である365日を7で除算
すると、52余り1となる。これは、曜日が1年毎に1
日ずつ先に進むことを意味している。具体的には、19
98年1月1日が木曜日であり、1999年1月1日が
金曜日となるということである。また、グレゴリオ暦に
よる西暦は400年周期で同じ日が同じ曜日となる。つ
まり、2000年1月1日と2400年1月1日は同じ
曜日となる。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The day of the week changes every seven days,
Dividing 365 days, which is the normal number of days in a year excluding leap years, by 7, gives 1 more than 52 days. This means that the day of the week is one year
It means moving forward day by day. Specifically, 19
That is, Thursday, January 1, 1998, and Friday, January 1, 1999. In the Gregorian calendar, the same day is the same day of the week in a 400-year cycle. That is, January 1, 2000 and January 1, 2400 are the same day of the week.

【0008】これらの事実から、西暦を400で除算し
た余り、つまり0年から399年の間で曜日を計算すれ
ば、扱う数値を小さく抑えて曜日の算出を行うことが可
能である。
From these facts, if the remainder of the year is divided by 400, that is, if the day of the week is calculated from the year 0 to the year 399, it is possible to calculate the day of the week with a small numerical value to be handled.

【0009】以下、本発明に係る曜日算出方法及び曜日
算出装置について図面を参照して説明する。
Hereinafter, a day of the week calculation method and a day of the week calculation apparatus according to the present invention will be described with reference to the drawings.

【0010】図1は本発明に係る曜日算出装置の一実施
例を示すブロック図である。図2は本発明に係る曜日算
出装置の動作を示すフローチャートである。図3は本発
明に係る曜日算出装置の方法の月−日数変換テーブルを
示す図であり、図4は本発明に係る曜日算出装置の曜日
変換テーブルを示す図である。
FIG. 1 is a block diagram showing an embodiment of the day of the week calculating apparatus according to the present invention. FIG. 2 is a flowchart showing the operation of the day of the week calculation device according to the present invention. FIG. 3 is a diagram illustrating a month-day conversion table of the method of the day-of-week calculating device according to the present invention, and FIG. 4 is a diagram illustrating a day-of-week conversion table of the day-of-week calculating device according to the present invention.

【0011】図1によれば、まず、所望の年月日である
A年B月C日を手動または自動にて入力する。入力され
た年月日を年と月と日に分けて、年Aを除算部1に入力
する。除算部1では年Aを400で除算した際の第1の
余りEを算出する。
According to FIG. 1, first, a desired date A, B, C is input manually or automatically. The input date is divided into year, month, and day, and the year A is input to the division unit 1. The division unit 1 calculates a first remainder E when the year A is divided by 400.

【0012】閏年数算出部2では第1の余りEを元に閏
年の数Uを算出する。ただし、年Aを400で除算して
いるため、過去400年以内の閏年の数となる。
The leap year calculator 2 calculates the number U of leap years based on the first remainder E. However, since the year A is divided by 400, it is the number of leap years within the last 400 years.

【0013】一方、閏年判定部3では、所望の年Aが閏
年であるか否かを判定する。閏年の法則は「1.400
で割り切れる年は閏年。2.400で割り切れない年の
中で、100で割り切れる年は閏年ではない。3.10
0で割り切れない年の中で、4で割り切れる年は閏年で
ある。」となっているが、本発明では、除算部1の出力
である第1の余りEを利用しており、この余りEの範囲
が0から399であるため、第1の余りEが0であるか
又は4の倍数であるか、100であるか、200である
か、300であるかを調べることで所望の年Aが閏年で
あるかを判定する。更に、所望の年Aが閏年であるとき
には、所望の月Bが3以上であるかを判別し3以上であ
れば閏年の加算日L=1とし、2以下であれば閏年の加
算日L=0とする。これは所望の月Bが3以上であると
きには、閏年分の1日を加算する必要があるからであ
る。
On the other hand, the leap year determining section 3 determines whether or not the desired year A is a leap year. The rule for leap years is "1.400
The year divisible by is a leap year. 2. Years that are not divisible by 400 but divisible by 100 are not leap years. 3.10
Years that are not divisible by 0 and are divisible by 4 are leap years. However, in the present invention, the first remainder E which is the output of the division unit 1 is used. Since the range of the remainder E is 0 to 399, the first remainder E is 0. It is determined whether the desired year A is a leap year by examining whether it is or a multiple of 4, 100, 200, or 300. Further, when the desired year A is a leap year, it is determined whether the desired month B is 3 or more. If the desired month B is 3 or more, the leap year addition date L = 1. Set to 0. This is because when the desired month B is 3 or more, it is necessary to add one day for a leap year.

【0014】次にテーブル変換部4では、所望の月Bに
応じて、図3に示す月−日数変換テーブルによって日数
Fを決定する。
Next, the table conversion unit 4 determines the number of days F according to a desired month B by using a month-day number conversion table shown in FIG.

【0015】そして、加算部5にて閏年の数U、閏年の
加算日L、日数F、所望の日Cを加算し、この値Mを除
算部6によって7で除算し、第2の余りNを求める。こ
の第2の余りNに応じて、図4に示す曜日変換テーブル
によって所望の年月日の曜日が得られる。
Then, the number U of leap years, the day L of addition of leap years, the number of days F, and the desired day C are added by the adding section 5, and this value M is divided by 7 by the dividing section 6 to obtain the second remainder N Ask for. According to the second remainder N, a desired day of the week is obtained from the day of the week conversion table shown in FIG.

【0016】次に図2を参照して本発明に係る曜日算出
装置の一実施例の動作を説明する。
Next, the operation of the embodiment of the day of the week calculating apparatus according to the present invention will be described with reference to FIG.

【0017】まず、所望の年月日をA年B月C日とする
と、所望の年Aを400で除算し、第1の余りEを求め
る(ステップS01)。
First, assuming that the desired date is B, C, A, the desired year A is divided by 400 to obtain a first remainder E (step S01).

【0018】次に、所望の年A年までの第1の余りE年
間(例えば所望の年が1998年であれば第1の余りE
=398年間)の閏年の数Uを求める。まず、第1の余
りEが0であるか否かを調べ(ステップS02)、第1
の余りが0であれば、閏年の数Uも0となり(ステップ
S03)、第1の余りEが0ではないときには閏年の数
Uは数1の通りとなる(ステップS04)。
Next, the first remainder E years to the desired year A (for example, if the desired year is 1998, the first remainder E
= 398 years). First, it is determined whether or not the first remainder E is 0 (step S02).
If the remainder is 0, the number U of leap years is also 0 (step S03), and if the first remainder E is not 0, the number U of leap years is as shown in equation 1 (step S04).

【0019】[0019]

【数1】 更に、所望の年Aが閏年であるか否かを調べる。閏年は
前述したように「1.400で割り切れる年は閏年。
2.400で割り切れない年の中で、100で割り切れ
る年は閏年ではない。3.100で割り切れない年の中
で、4で割り切れる年は閏年である。」との条件によっ
て定められているが、本発明では第1の余りが0から3
99の間にあるため、1番目の条件である「400で割
り切れる年」を除外することができる。そこで、閏年の
判定を次のように行うことが可能である(ステップS0
5〜ステップS08)。まず、第1の余りEを2進数で
表したとき、その下位2ビットが0となるかどうかを調
べる。これは、2進数において、下位2ビットが0であ
るとき、この値が4の倍数となるからである(ステップ
S05)。ただし、第1の余りが0であるときには4の
倍数ではないが閏年の可能性があるものとする。
(Equation 1) Further, it is determined whether or not the desired year A is a leap year. A leap year is a leap year if it is divisible by 1.400.
2. Years that are not divisible by 400 but divisible by 100 are not leap years. A year divisible by 4 is a leap year if it is not divisible by 3.100. In the present invention, the first remainder is 0 to 3
Since it is between 99 and 99, the first condition “year divisible by 400” can be excluded. Therefore, the determination of the leap year can be performed as follows (step S0).
5 to Step S08). First, when the first remainder E is represented by a binary number, it is checked whether or not the lower two bits are 0. This is because when the lower 2 bits are 0 in a binary number, this value is a multiple of 4 (step S05). However, when the first remainder is 0, it is not a multiple of 4 but may be a leap year.

【0020】一方、第1の余りEを2進数で表したと
き、下位2ビットが0でないときには、所望の年Aは閏
年ではないと判断されステップS11へ移行する。ま
た、第1の余りEを2進数で表したときの下位2ビット
が0であるときには所望の年Aが閏年である可能性があ
るものとして、ステップS06へと移行する。
On the other hand, when the first remainder E is represented by a binary number and the lower 2 bits are not 0, it is determined that the desired year A is not a leap year, and the process shifts to step S11. If the lower two bits of the first remainder E in binary are 0, it is determined that the desired year A may be a leap year, and the process proceeds to step S06.

【0021】ステップS06では、第1の余りEが10
0であるか否かを調べる。そして、第1の余りEが10
0であるときにはステップS11へ移行し、第1の余り
Eが100ではないときにはステップS07へと移行す
る。
In step S06, the first remainder E is 10
Check to see if it is zero. And the first remainder E is 10
When it is 0, the process proceeds to step S11. When the first remainder E is not 100, the process proceeds to step S07.

【0022】ステップS07では、第1の余りEが20
0であるか否かを調べる。そして、第1の余りEが20
0であるときにはステップS11へ移行し、第1の余り
Eが200ではないときにはステップS08へと移行す
る。
In step S07, the first remainder E is 20
Check to see if it is zero. And the first remainder E is 20
When it is 0, the process proceeds to step S11. When the first remainder E is not 200, the process proceeds to step S08.

【0023】ステップS08では、第1の余りEが30
0であるか否かを調べる。そして、第1の余りEが30
0であるときにはステップS11へ移行し、第1の余り
Eが300ではないときにはステップS09へと移行す
る。
In step S08, the first remainder E is 30
Check to see if it is zero. And the first remainder E is 30
When it is 0, the process proceeds to step S11, and when the first remainder E is not 300, the process proceeds to step S09.

【0024】このような処理を行うことで、所望の年A
が閏年であるときにはステップS09へ移行し、閏年で
はないときにはステップS11へと移行する。このよう
に、上述したステップS05〜ステップS08による閏
年判定方法によれば、実際の所望の年Aを除算すること
なしに4つの比較器によって構成できるため、回路規模
が小さくなる。
By performing such processing, the desired year A
If is a leap year, the process proceeds to step S09, and if not, the process proceeds to step S11. As described above, according to the leap year determination method in steps S05 to S08 described above, since the comparator can be configured by four comparators without dividing the actual desired year A, the circuit scale is reduced.

【0025】次に、所望の年Aが閏年であるときに、所
望の日Cが、2月29日以前であるか否かを調べる。そ
のために、所望の月Bが3以上であるか否かを調べ、3
以上であるときにはステップS10へと移行し、2以下
であるときにはステップS10へと移行する。そして、
ステップS10では閏年の加算日L=1とし、ステップ
S11では閏年の加算日L=0としてステップS12へ
移行する。
Next, when the desired year A is a leap year, it is checked whether or not the desired day C is before February 29. For this purpose, it is determined whether or not the desired month B is 3 or more.
If so, the process proceeds to step S10, and if less than 2, the process proceeds to step S10. And
In step S10, the leap year addition day L = 1 is set, and in step S11, the leap year addition day L = 0 is set, and the process proceeds to step S12.

【0026】ステップS12では、1月1日から所望の
月Bの前月末日までの日数Fを図3に示す月−日数変換
テーブルを使って取得し、(閏年分の1日は数えない)
ステップS13へ移行する。
In step S12, the number of days F from January 1 to the end of the previous month of the desired month B is obtained using the month-day number conversion table shown in FIG. 3 (one day of a leap year is not counted).
Move to step S13.

【0027】ステップ13ではこれまでに得られた数値
を合計してその数値を7で除算する。具体的には、第1
の余りE、閏年の数U、閏年の加算日L、日数F、所望
の日Cを合計し、7で除算する。そして、得られた第2
の余りNを図4に示す曜日変換テーブルを使って所望の
年月日の曜日を取得することができる。
In step 13, the numerical values obtained so far are summed and the numerical value is divided by seven. Specifically, the first
The remainder E, the number U of leap years, the added day L of leap years, the number of days F, and the desired day C are summed and divided by 7. And the obtained second
By using the day of the week conversion table shown in FIG.

【0028】次に、具体的な数値を使用して説明する。Next, a description will be given using specific numerical values.

【0029】例えば、所望の年月日が1998年12月
31日であるとき、A=1998、B=12、C=31
である。
For example, when the desired date is December 31, 1998, A = 1998, B = 12, C = 31
It is.

【0030】Aを400で除算したときの第1の余りE
は398であり、閏年の数Uは97となる。
The first remainder E when A is divided by 400
Is 398, and the number U of leap years is 97.

【0031】そして、1998年が閏年であるかの判定
は、第1の余りE=398を2進数で表すと11000
1110となり、その下位2ビットは10となる。従っ
て、第1の余りEを2進数で表したときの下位2ビット
は00ではないので、1998年は閏年ではない。よっ
てL=0となる。
Then, whether or not 1998 is a leap year can be determined by expressing the first remainder E = 398 in binary notation as 11000.
1110, and its lower two bits become 10. Therefore, 1998 is not a leap year because the lower two bits when the first remainder E is represented by a binary number are not 00. Therefore, L = 0.

【0032】更に、1月1日から所望の月Bの前月末日
までの日数を図3の月−日数変換テーブルによって取得
する。月B=12であるから、F=334となる。
Further, the number of days from January 1 to the end of the previous month of the desired month B is obtained from the month-day number conversion table of FIG. Since month B = 12, F = 334.

【0033】次に、得られた数値を合計すると、第1の
余りE+閏年の数U+閏年の加算日L+日数F+所望の
日C=398+97+0+334+31=860を7で
除算してその余りNを算出する。するとN=6となり、
この値から図4に示す曜日変換テーブルを使用して所望
の年月日が木曜日であることが判る。
Next, when the obtained numerical values are summed, the remainder N is calculated by dividing the first remainder E + the number of leap years U + the number of added days L + the number of days F + the desired date C = 398 + 97 + 0 + 334 + 31 = 860 by 7. . Then N = 6,
From this value, it can be seen that the desired date is Thursday using the day conversion table shown in FIG.

【0034】[0034]

【発明の効果】以上詳述したように、本発明に係る曜日
算出方法及び曜日算出装置によれば、西暦を0から39
9の数値に置き換えて曜日算出を行うため、扱う数値を
小さくすることができ、回路規模を小さくすることがで
きるという効果を奏する。
As described above in detail, according to the day of the week calculating method and the day of the week calculating apparatus according to the present invention, the year is set to 0 to 39.
Since the day of the week calculation is performed instead of the numerical value of 9, the numerical value to be handled can be reduced and the circuit scale can be reduced.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明に係る曜日算出方法及び曜日算出装置を
示すブロック図である。
FIG. 1 is a block diagram illustrating a day of the week calculation method and a day of the week calculation device according to the present invention.

【図2】本発明に係る曜日算出方法及び曜日算出装置の
動作を示すフローチャートである。
FIG. 2 is a flowchart illustrating an operation of a day calculation method and a day calculation device according to the present invention.

【図3】月−日数変換テーブルを示す図である。FIG. 3 is a diagram showing a month-day number conversion table;

【図4】曜日変換テーブルを示す図である。FIG. 4 is a diagram showing a day of the week conversion table.

【符号の説明】[Explanation of symbols]

1,6 除算部 2 閏年数算出部 3 閏年判定部 4 テーブル変換部 5 加算部 1, 6 division unit 2 leap year calculation unit 3 leap year judgment unit 4 table conversion unit 5 addition unit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】所望の西暦A年B月C日に対して、その曜
日を算出する曜日算出方法であって、 その年Aを400で除算し第1の余りEを算出するステ
ップと、 前記A年の前年までの閏年の数(第1の余りE年間)U
を算出するステップと、 前記第1の余りEを2進数で表記したときに下位2ビッ
トが00になり、前記第1の余りEが100、200、
300のいずれでもないときに前記A年が閏年であると
判別するステップと、 前記A年が閏年であるときに、前記B月が3以上である
ときに閏年加算日Lを1とし、前記B月が2以下である
ときに閏年加算日Lを0とするステップと、 1月1日から所望の月Bの前月の末日までの日数Fを算
出するステップと、 前記第1の余りEと、前記閏年の数Uと、前記閏年加算
日Lと、日数Fと、所望の日である日Cを加算してその
和Mを演算するステップと、 前記和Mを7で除算して得られた第2の余りNを曜日算
出テーブルに適用することで曜日を算出するステップと
からなる曜日算出方法。
1. A day of the week calculation method for calculating a desired day of the week of B / C of the year A, wherein the year A is divided by 400 to calculate a first remainder E; Number of leap years up to the previous year of A (first remaining E years) U
And calculating the first remainder E in a binary number, the lower 2 bits become 00, and the first remainder E becomes 100, 200,
Determining that the year A is a leap year when it is not any of 300; setting the leap year addition day L to 1 when the month B is 3 or more when the year A is a leap year; Setting the leap year addition day L to 0 when the month is 2 or less; calculating the number of days F from January 1 to the last day of the month before the desired month B; and the first remainder E; Adding the leap year number U, the leap year addition day L, the number of days F, and the desired day C to calculate a sum M thereof, and dividing the sum M by 7 Calculating the day of the week by applying the second remainder N to the day of the week calculation table.
【請求項2】所望の西暦A年B月C日に対して、その曜
日を算出する曜日算出装置であって、 Aを400で除算して第1の余りEを算出する手段と、 前記A年の前年までの閏年の数(第1の余りE年間)U
を算出する手段と、 前記第1の余りE及び所望の月Bより所望の西暦A年B
月C日が閏年であるかを判別し、閏年であるときには閏
年加算日Lを1とし、閏年ではないときには閏年加算日
Lを0として出力する手段と、 1月1日から所望の月Bの前月の末日までの日数Fを出
力する手段と、 前記第1の余りEと、前記閏年の数Uと、前記閏年加算
日Lと、日数Fと、所望の日である日Cを加算してその
和Mを演算する手段と、 前記和Mを7で除算して得られた第2の余りNを曜日算
出テーブルに適用することで曜日を算出する手段とから
なる曜日算出装置。
2. A day-of-week calculating apparatus for calculating a desired day of the week of B / C of the year A, wherein A is divided by 400 to calculate a first remainder E. Number of leap years up to the previous year of the year (first remainder E years) U
A desired year A B from the first remainder E and the desired month B
Means for judging whether the month C is a leap year, outputting a leap year addition day L as 1 when the month C is a leap year, and outputting 0 as a leap year addition day L when the month C is not a leap year; Means for outputting the number of days F up to the last day of the previous month; adding the first remainder E, the number U of the leap years, the leap year addition day L, the number of days F, and the day C which is a desired day. A day calculation device comprising: means for calculating the sum M; and means for calculating the day of the week by applying the second remainder N obtained by dividing the sum M by 7 to the day of the week calculation table.
JP10291782A 1998-10-14 1998-10-14 Method and device for calculating day of week Pending JP2000122998A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10291782A JP2000122998A (en) 1998-10-14 1998-10-14 Method and device for calculating day of week

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10291782A JP2000122998A (en) 1998-10-14 1998-10-14 Method and device for calculating day of week

Publications (1)

Publication Number Publication Date
JP2000122998A true JP2000122998A (en) 2000-04-28

Family

ID=17773363

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10291782A Pending JP2000122998A (en) 1998-10-14 1998-10-14 Method and device for calculating day of week

Country Status (1)

Country Link
JP (1) JP2000122998A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114815572A (en) * 2022-04-29 2022-07-29 杭州晶华微电子股份有限公司 Real-time clock unit circuit capable of automatically calculating week value

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114815572A (en) * 2022-04-29 2022-07-29 杭州晶华微电子股份有限公司 Real-time clock unit circuit capable of automatically calculating week value

Similar Documents

Publication Publication Date Title
van Dongen et al. Cycle time prediction: When will this case finally be finished?
CN111639965B (en) Integral updating method and device
CN111582771A (en) Risk assessment method, device, equipment and computer readable storage medium
CN102542437B (en) Task expiration reminding method and device
JP2000122998A (en) Method and device for calculating day of week
CN113020286B (en) Stability control method and device for rolling process
JPS6035701B2 (en) Date information processing device
JP2912225B2 (en) Communication processing system
JPH05223860A (en) Digital spectrum analyzer
CN110245115A (en) A kind of document handling method, engine and system
JP2001133537A (en) Device for calculating coordinates, and computor- readable recording medium with coordinate calculating program recorded
US7424391B2 (en) Period division statistics device, method, and program product
US8856084B2 (en) Data processing method and device
JPH0675068A (en) Automatic day of the week calculator
CN107944937B (en) User category determination method and device
JP6952927B1 (en) Location prediction device, location prediction method, and location prediction program
JPS59149547A (en) 6-weekday arithmetic processor
JP4142143B2 (en) Data correction device
US20220276864A1 (en) Software analysis apparatus
JPH10153671A (en) Device for setting day-of-the-week and method therefor
JPH09146891A (en) Device and method for calculating day of week handling entire christian era
JPS61147454U (en)
JPH01141392A (en) Elapsed time calculator
CN111784008A (en) Product life cycle estimation method and device, electronic equipment and storage medium
CN118068917A (en) Method, device, equipment and storage medium for generating high-precision clock in simulation