Computation of Calendar by Using Gregorian's Day Formula: Khin Sandar Win, Myat Phone San

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Computation of Calendar by Using Gregorian’s Day

Formula
Khin Sandar Win#a, Myat Phone San#b
#a
Department of Engineering Mathematics, Technological University (Hpa-an), Technological University
(Meiktila)
Myanmar
a
khinkhin.khkh123@gmail.com, bmyatphonesan131619@gmail.com

Abstract Calendars play an important role in our daily life.


They are used to provide people manage their personal time, II. DETERMINING the DAYS to GET
schedule and activities. The calendar that we know and use CALENDAR
today, the Gregorian calendar, first came into use around
1582. Pope Gregory XIII made today calendar. But, most The calendar we use today is called the Gregorian
people don’t know how he calculates the calendar. Before calendar. It was made by Pope Gregory XIII. The
determining the calendar, it is essential to know the initial
days of every month. This means that the initial day can be Gregorian’s day formula is very important not only to
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday determine the day of the week but also to calculate
or Sunday. Everyone doesn’t know exactly what the initial calendar. The Gregorian’s day formula is as follows,
day first comes in a calendar. This paper is expressed
calculating any days by using Gregorian’s day formula. (
Firstly, year code, month code, century code and leap year ) (1)
codes are presented to complete Gregorian’s day formula. In
each code, some basic concepts, definitions and theorems where, YC=Year Code,
with illustrative examples are expressed. This paper has
large of its application in computer engineering. Computing MC=Month Code,
with computer is much faster than manual calculations.
Computational tasks are accurate, fast and correct. After CC=Century Code,
calculating days by using Gregorian’s day formula in
computer programming software, the accurate and correct DN= Date Number,
initial days of every month are immediately gained. If the
beginning days of every month are gained, the calendar can LYC=Leap Year Code,
be easily computed.
% means remainder.
Keywords calendar, computer, code, correct, day
A. The Year Code
I. INTRODUCTION To determine the day of the week, the year code is an
Calendars are interesting mathematical tools. The essential part in the Gregorian’s day formula.
Gregorian calendar was first begun in 1582 in parts of
Europe. It was adopted in 1752 in Britain, its colonies and
various countries. The first calendar was made by 1) Theorem: To calculate the year code, the formula
scientists in Egypt, but it was not scientific. Then, the is as follows,
Julius Caesar calendar was appeared. Julius Caesar ( ⁄ ) (2)
thought that a year should be 365days and 6 hours long.
From this equation, YY is the year’s last two digits. As an
However, the calendar was almost twelve minutes fast.
Today, the Gregorian calendar is the most widely used example, the year, 1897, the last two digits (97) is taken.
calendar in the world. Then, divide YY by 4. The next step is solving
In this paper, the Gregorian’s day formula is applied ( ⁄ ) . The solving result is divided by 7. The final
to calculate the correct days and calendar. Then, it is also
result is kept only the remainder.
effective in computer engineering. It can be calculated the
accurate days and calendar just a minute by using
computer programming languages such as C++, C#, Java 2) Example: The year is 1897.
and Python etc. Just knowing the Gregorian’s day ( ⁄ )
formula, it does not need to execute by hand but the
computer can be calculated within a short time. [ ( ⁄ )]
Therefore, the year code for 1897 is 2.  1700 is not a leap year because it is divisible by
100.
B. The Month Code  2000 is a leap year because it can be divided by
To find the day of the week, the month code is also 400.
vital as a part of the Gregorian’s day formula. Leap year code is essential to complete the
Gregorian’s day formula.
1) Theorem: To compute the month code, it needs
to memorize the numbers- 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5. 1) Theorem: If the date is in a January or February
The corresponding month codes for each months are as of a leap year, the total sum will have to be subtracted one
follows, before the final step. In other words, the leap year code is
 January=0, one.
 February=3, In this case, the following formula is obtained.
 March=3, ( )
 April=6,
 May=1, 2) Example: 1/1/2000
 June=4, From that date, 2000 is a leap year because it can be
 July=6, divided by 4. It is also divisible by 400. From the
 August=2, theorem, its leap year code is 1 because the date is in
 September=5, January.
 October=0,
E. Calculating the Day of the Week
 November=3,
Pope Gregory XIII determined the number codes for
 December=5. the day of the week as follows,
For example, Bogyoke Aung San’s birthday is in
February, its respective month code is 3.  Sunday=0,
 Monday=1,
C. Century Code  Tuesday=2,
Century means a period of one hundred years. To  Wednesday=3,
complete the Gregorian’s day formula, the century code is  Thursday=4,
 Friday=5,
applied.
 Saturday=6.
Now, the formula determination is completed.
1) Theorem: For the Gregorian calendar, the
numbers- 4, 2, 0, 6 are alternatively taken. The following 1) Example: Bogyoke Aung San was born in
describes corresponding century codes. 13/2/1915. To determine his day of the week, the
Gregorian’s formula is applied.
 1700s=4, From the date, YC= [15+ (15/4)] %7=4,
MC= 3,
 1800s=2,
CC= 0,
 1900s=0, DN= 13,
 2000s=6, LYC= 0,
 2100s=4, The day’s formula is
 2200s=2, ( )
( )
 2300s=0,
 2400s=6, The final result is 6. So, Bogyoke Aung San was born on
For example, the current year is 2020. The year, 2020 Saturday.
includes in 2000s. So, its century code is considered as 6.
F. Determining Gregorian’s Calendar (Today
D. Leap Year Code Calendar)
Pope Gregory XIII specified the length of the months
If a Gregorian year can be divided by 4, it is a leap
as follows,
year, unless it is divisible by 100. But, it is also a leap  January=31,
year if it is divisible by 400. The following examples are  February=28,
more apparent to determine leap year.  March=31,
 2020 is a leap year because the year can be divided  April=30,
by four.  May=31,
 June=30,
 July=31, The day’s formula is
 August=31, ( )
 September=30, ( )
 October=31,
 November=30, Therefore, the initial day of the first month, January
 December=31. for the year, 2021 is Friday. From the initial day of the
But, February is about 29 days long when it is in the leap first month, correct 2021 calendar for the first month,
year. January is obtained. The other months- February, March,
Pope Gregory XIII determined the calendar by April, May, June, July, August, September, October,
applying the day’s formula. By calculating the initial days November and December for the year 2021 can also be
of each month, the correct calendar can be received. If the executed like this example. The following table describes
day’s formula can be applied properly, the past calendar the correct 2021 calendar for the first month, January.
(1900, 1971, 1999, etc.), the current calendar (2020) and
TABLE II
the future calendar (2021, 2030, 2080, etc.) can be
Correct 2021 Calendar (January)
computed.
SUN MON TUE WED THU FRI SAT
1) Calculating the current calendar: 1/1/2020 is the 1 2
initial date number of the first month, January for the 3 4 5 6 7 8 9
year, 2020. To know the initial day of first month 10 11 12 13 14 15 16
systematically, the Gregorian’s day formula is applied. 17 18 19 20 21 22 23
From the given date, YC (2020) = [20+ (20/4)] %7=4, 24 25 26 27 28 29 30
MC (January) = 0, 31
CC (2000s) = 6,
DN = 1,
LYC = 1,
The day’s formula is III. APPLICATION in COMPUTER
( ) ENGINEERING
( )
The Gregorian’s day formula is very useful in
Therefore, the initial day of the first month, January computer engineering. Computer engineers think how to
for the year, 2020 is Wednesday. From the initial day of solve easily and quickly the problems of the environment.
the first month, correct 2020 calendar for the first month, In thinking, some used to solve them by programming
January is obtained. codes. In writing programming codes, accurate math
formulas, concepts and algorithms are needed. After
TABLE I
writing programming codes with respective formulas and
CORRECT 2020 CALENDAR (JANUARY)
algorithms, and running the program, the output is
SUN MON TUE WED THU FRI SAT immediately expressed on the computer screen. This
1 2 3 4 means that much of the sheer tedium of calculating day’s
5 6 7 8 9 10 11 formula by hand is eliminated. The computer can always
12 13 14 15 16 17 18
be executed the accurate, fast and correct data. The
19 20 21 22 23 24 25
26 27 28 29 30 31 following example describes calculating days by using
C++ programming language.
Likewise, the other initial days of the months-
A. Calculation of the day (by C++ programming
February, March, April, May, June, July, August,
September, October, November and December can also language)
be calculated by using the Gregorian’s day formula for the By applying the Gregorian’s day formula in C++
year 2020. codeblock software, the day of the week can be calculated
2) Estimating the Next Year Calendar: 1/1/2021 is within a short time. The following C++ programming
the initial date number of the first month, January for the codes are described calculation of the day for the month,
year, 2021. To know the initial day of first month April during the 20 centuries.
systematically, the Gregorian’s day formula is applied. #include <iostream>
From the given date, YC (2021) = [21+ (21/4)] %7=5, using namespace std;
MC (January) = 0,
CC (2000s) = 6, int main()
DN = 1,
{
LYC = 0,
cout<<"You can enter any date number and year but the else if(day==3)
answer will show you the day of the week during the
cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is
fourth month, 'April': "<<endl;
Wednesday."<<endl<<endl;
int Date_num;
else if(day==4)
cout<<"Enter date number: ";
cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is
cin>>Date_num; Thursday."<<endl<<endl;
int year; else if(day==5)
cout<<"Enter a year: "; cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is
Friday."<<endl<<endl;
cin>>year;
else if(day==6)
int num;
cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is
cout<<"Enter the last two digits of the year: ";
Saturday."<<endl<<endl;
cin>>num;
return 0;
cout<<endl;
}
int sum=num/4;
By running this C++ code in C++ software, the correct
int total=sum+num; days will be immediately shown in computer screen. In
int yearcode=total%7;//by applying year code formula this case, writing code is too long for programmers but it
is helpful for other people because other people can easily
const int monthcode_April=6; see the accurate day on computer screen. No need to
const int centurycode=6; calculate by hand.

const char SUN=0;


const char MON=1;
const char TUE=2;
const char WED=3;
const char THU=4;
const char FRI=5;
const char SAT=6;
int
totalsum=(yearcode+centurycode+monthcode_April+Dat
e_num); /*leap year code is zero because leap year code is Figure 1: Computational Tasks for Programmers
considered only two months, January and February.*/
Behind the scenes, the programmers have to use math
int day=totalsum%7;//applying Gregorian’s day formula formulas and algorithms to write long codes.
if(day==0)
cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is
Sunday."<<endl<<endl;
else if(day==1)
cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is
Monday."<<endl<<endl;
else if(day==2)
Figure 2: Appearing the Respective Data and Showing the
cout<<Date_num<<"/"<<"April"<<"/"<<year<<"is Correct Day of 17/April/2020 during 8.782s
Tuesday."<<endl<<endl;
By clicking the running button in the C++ software,
the user can easily see the correct day without calculating. REFERENCES
From the figure, the users will have to type the complete [1] David Braverman, The Mathematics of the Gregorian
Calendar, India, 2009.
data such as date number, year and last two digits of the [2] E. G. Richards, Mapping Time: The Calendar and its
year to get the correct day. And, the result will be Histroy, Oxford University, 1998.
suddenly expressed within a second after typing the [3] Ismael Fortunado, “Julian Calendar and Gregorian
Calendar Algorithms”, International Peer Reviewed
“Enter” key as described in figure 2. Therefore, the use of Journal, vol. 9, University of Santo Tomas, Philippines,
Gregorian’s day formula in computer engineering reduces January, 2014.
[4] Robert Lafore, Object-Oriented Programming in C++, 4th
the waste of time and errors. Human calculation by hand ed., December, 2001.
can be many errors. But, the machine gives the right
answer for any problems. After calculating the days of
every month by computer, the right calendar is
immediately gained.
IV. CONCLISIONS
In this paper, the concepts of calculating days and
calendar are completely presented. Then, the day’s
formula can be used in computer programming. By
writing programming codes with the use of this formula, it
doesn’t need to calculate by hand because the computer
executes the correct days within a short time. The
calendar is necessary for everyone. Workers, teachers,
students, civil servants, doctors and other people work
with time. Meeting day, working day, holidays and
festival days, etc. are specified by using the calendar.
Therefore, the calendar is an important part of everyday
life for everyone.

APPENDIX

PROGRAMMING CODE’S MEANINGS

No. Codes Meanings


1 #include Header file in the program
(preprocessor directive)
2 <iostream> Input/output stream that
includes input/output
statements
3 cin An object of input stream
that is used to take input. In
other words, users type
respective data to get the
result
4 cout An object of output stream
that is used to show the
output
5 >> String insertion operator
6 << String extraction operator
7 //and /*----- Single-line comment and
*/ multi-line comment

ACKNOWLEDGEMENT
We are grateful to the committee of JIRT and the
editorial board for permitting the submission of this paper.
Thanks to my son, Mg Myat Phone San, III-IT-1,
Technological University (Meiktila) for his collaboration
to this research.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy