Calculate the day for the particular date given

How to calculate which day it  is for a given date
There are two codes Month and Year Code
Month Code:
JAN-->0
FEB-->3
MAR-->3
APR-->6
MAY-->1
JUN--->4
JUL--->6
AUG-->2
SEP--->5
OCT--->0
NOV--->3
DEC---->5

Year Code

2064:
2--->1800--1899
0--->1900--1999
6--->2000--2099
4--->2100--2199

if we want for more than 2200 then same thing
2-->2200--2299 and so on

if we want for 1700--1799 go in reverse order

2--->1400--1499
0--->1500---1599
6-->1600--1699
4--->1700--1799



Add the date + last two digits of the year+last two digits of the year/4 +month code + century code

Divide by 7 and take the remainder

remainder-->0-->Sunday
remainder-->1--->Monday
remainder--->2--->Tuesday
remainder--->3---->Wednesday
remainder--->4---->Thursday
remainder--->5---->Friday
remainder---->6---->Saturday



I will explain with example


15-08-1947

date=15
last two digits of year=47
year/4=11
month code=2.
year code=0


add everything:15+47+11+2+0=75

divide by and take the remainder:75%7=5

Its friday. That's it

Practice will make u do everything in mind


Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PR, PN and PV Variable in Yocto