Math, asked by babusambit1340, 1 year ago

How to calculate day from date?

Answers

Answered by shaina25
1
Take the last 2 digits of the year. ...Divide by 4, and drop any remainder. ...Add the day of the month. ...Add the month's key value, from the following table. ...If your date is in January or February of a leap year, subtract 1. ...Add the century code from the following table.
Answered by Ihtihas
0
There are two popular formulas that you can use to find the day of the week for a given date. You should be careful when you use these formulas, though, because they only work for the Gregorian calendar. (People in English-speaking countries used a different calendar before September 14, 1752.)

Zeller's Rule

The following formula is named Zeller's Rule after a Reverend Zeller. [x] means the greatest integer that is smaller than or equal to x. You can find this number by just dropping everything after the decimal point. For example, [3.79] is 3. Here's the formula:

f = k + [(13*m-1)/5] + D + [D/4] + [C/4] - 2*C.

k is the day of the month. Let's use January 29, 2064 as an example. For this date, k = 29.m is the month number. Months have to be counted specially for Zeller's Rule: March is 1, April is 2, and so on to February, which is 12. (This makes the formula simpler, because on leap years February 29 is counted as the last day of the year.) Because of this rule, January and February are always counted as the 11th and 12th months of the previous year. In our example, m = 11.D is the last two digits of the year. Because in our example we are using January (see previous bullet) D = 63 even though we are using a date from 2064.C stands for century: it's the first two digits of the year. In our case, C = 20.

Now let's substitute our example numbers into the formula.

f = k + [(13*m-1)/5] + D + [D/4] + [C/4] - 2*C
= 29 + [(13*11-1)/5] + 63 + [63/4] + [20/4] - 2*20
= 29 + [28.4] + 63 + [15.75] + [5] - 40
= 29 + 28 + 63 + 15 + 5 - 40
= 100.

Once we have found f, we divide it by 7 and take the remainder. Note that if the result for f is negative, care must be taken in calculating the proper remainder. Suppose f = -17. When we divide by 7, we have to follow the same rules as for the greatest integer function; namely we find the greatest multiple of 7 less than -17, so the remainder will be positive (or zero). -21 is the greatest multiple of 7 less than -17, so the remainder is 4 since -21 + 4 = -17. Alternatively, we can say that -7 goes into -17 twice, making -14 and leaving a remainder of -3, then add 7 since the remainder is negative, so -3 + 7 is again a remainder of 4.

A remainder of 0 corresponds to Sunday, 1 means Monday, etc. For our example, 100 / 7 = 14, remainder 2, so January 29, 2064 will be a Tuesday.

The Key Value Method

This method uses codes for different months and years to speed up the calculation of the day of the week. You might even be able to memorize the codes. We'll use December 16, 2482 as an example.

Take the last 2 digits of the year. In our example, this is 82.

Divide by 4, and drop any remainder. 82 / 4 = 20, remainder 2, so we think "20."

Add the day of the month. In our example, 20 + 16 = 36.

Add the month's key value, from the following table.

JanFebMarAprMayJuneJulyAugSeptOctNovDec144025036146

The month for our example is December, with a key value of 6. 36 + 6 = 42.

If your date is in January or February of a leap year, subtract 1. We're using December, so we don't have to worry about this step.

Add the century code from the following table. (These codes are for the Gregorian calendar. The rule's slightly simpler for Julian dates.)

1700s1800s1900s2000s4206

Our example year is 2482, and the 2400s aren't in the table. Luckily, the Gregorian calendar repeats every four hundred years. All we have to do is add or subtract 400 until we have a date that is in the table. 2482 - 400 = 2082, so we look at the table for the 2000s, and get the code 6. Now we add this to our running total: 42 + 6 = 48.

Add the last two digits of the year. 48 + 82 = 130.

Divide by 7 and take the remainder. This time, 1 means Sunday, 2 means Monday, and so on. A remainder of 0 means Saturday. 130 / 7 = 18, remainder 4, so December 16, 2482 will be on the fourth day of the week-- Wednesday
Similar questions