How To Find The Day Of The Week

Table of contents:

How To Find The Day Of The Week
How To Find The Day Of The Week

Video: How To Find The Day Of The Week

Video: How To Find The Day Of The Week
Video: Complete method: how to find the week-day for any date? 2024, December
Anonim

You can find out on what day of the week a particular date falls in the past, present or future, using the so-called perpetual calendar. You can make such a device at home.

How to find the day of the week
How to find the day of the week

Instructions

Step 1

Make seven calendar cards for one month, in the first of which the month begins on Monday, in the second on Tuesday, in the third from Wednesday, and so on until the calendar in which the month begins on Sunday. Assign numbers from 1 to 7 to the cards, and assign the first number to a calendar in which the month begins on Monday. Make these cards out of heavy cardboard and laminate them, because the calendar is designed to be stored and used for many years.

Step 2

Also include in the set of the perpetual calendar a card with the following formula: h = d + ((13m-1) / 5) + r + (y / 4) + (v / 4) -2v, where: - h is the intermediate result to be further transformation; - d - date; - m - month, chosen in a somewhat unusual way: March - the first month, February - twelfth; - d - the last two digits of the year number (if the month is January or February, then the previous year); - in - the number of the century from which the unit was subtracted (for January or February, subtract 2 instead of 1). This card is also made of thick cardboard and lamination. Staple all the cards together so that they are not lost. Make a convenient case for your perpetual calendar, if you wish, store a calculator of a suitable size in it.

Step 3

After making calculations according to the indicated formula, divide the result of h by seven with the remainder.

Step 4

Take the modulus from the remainder of the division.

Step 5

Take a card with a number equal to the result of the last calculation, and then use it to determine the day of the week.

Step 6

Optionally, write a program to perform calculations for both formulas in any programming language you know. In this case, however, division with remainder can be difficult, since there is no ready-made function for this in most programming languages. It is most convenient to use the Pascal language, in which the corresponding function is available. To find the integer part of the result of division with a remainder, use a line of the following form: c: = a div b. To find the remainder of division, use a line of another form: c: = a mod b.

Recommended: