Workshop on Oracle 11g - Database Design using Object Oriented Features: If you are a database enthusiast, then get the maximum benefit from this one day workshop on Oracle 11g by Mr. Sameer Dehadrai. More details can be found in the following picture / brochure and the Registration can be done at: http://tinyurl.com/lolyj7h
Wednesday, May 20, 2015
Monday, May 18, 2015
Dooms Day Algorithm to Find Week Day of Given Date
Posted by
umencs
Using Dooms Day Algorithm / Rule any one can find the week day of given date between 1800 - 2199 years. So, The dooms day rule / formula is as follows
Dooms day = Anchor Day + [Year/12] + Remainder[Year/12] + [Remainder[Year/12]]/4
If the given date's year falls,
between 1800-1899, The Anchor Day is Friday
between 1900-1999, The Anchor Day is Wednesday
between 2000-2099, The Anchor Day is Tuesday
between 2100-2199, The Anchor Day is Sunday
In the Above formula Year is last 2 digits of given date's year and in above equation solving wherever we get decimal values we have to take integer values only.
Once we get the dooms day for the given date's year using above formula, that dooms day will fall on last day of February (if given year is normal year on Feb 28, otherwise Feb 29), April 4 (4/4), June 6 (6/6), August 8 (8/8), October 10 (10/10) and December 12 (12/12).
Example: Lets find the week day of August 15, 1947.
The given date's year 1947 falls between 1900-1999 so the Anchor day is Wednesday.
Dooms day = Wednesday + [47/12] + Remainder[47/12] + [Remainder[47/12]]/4
Dooms day = Wednesday + 3 + 11 + 2
Dooms day = Wednesday + 16 (Divide this number by 7 and take remainder to find number of odd days)
Dooms day = Wednesday + 2 = Friday.
So the Dooms day for year 1947 is Friday and It will fall on August 8 as I said earlier. So, If August 8 is Friday after one week i.e., on August 15 is also going to be Friday.
So finally August 15, 1947 is Friday :-).
Dooms day = Anchor Day + [Year/12] + Remainder[Year/12] + [Remainder[Year/12]]/4
If the given date's year falls,
between 1800-1899, The Anchor Day is Friday
between 1900-1999, The Anchor Day is Wednesday
between 2000-2099, The Anchor Day is Tuesday
between 2100-2199, The Anchor Day is Sunday
In the Above formula Year is last 2 digits of given date's year and in above equation solving wherever we get decimal values we have to take integer values only.
Once we get the dooms day for the given date's year using above formula, that dooms day will fall on last day of February (if given year is normal year on Feb 28, otherwise Feb 29), April 4 (4/4), June 6 (6/6), August 8 (8/8), October 10 (10/10) and December 12 (12/12).
Example: Lets find the week day of August 15, 1947.
The given date's year 1947 falls between 1900-1999 so the Anchor day is Wednesday.
Dooms day = Wednesday + [47/12] + Remainder[47/12] + [Remainder[47/12]]/4
Dooms day = Wednesday + 3 + 11 + 2
Dooms day = Wednesday + 16 (Divide this number by 7 and take remainder to find number of odd days)
Dooms day = Wednesday + 2 = Friday.
So the Dooms day for year 1947 is Friday and It will fall on August 8 as I said earlier. So, If August 8 is Friday after one week i.e., on August 15 is also going to be Friday.
So finally August 15, 1947 is Friday :-).
Subscribe to:
Posts (Atom)