Skip to content

code (written in C) to check day by entering Date in DD/MM/YYYY format

License

Notifications You must be signed in to change notification settings

prigta008/minimal-calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Minimal Calendar

Last Updated : Oct. 26, 2021


 This code(written in C) can be used to know 
 the day of the entered date in DD/MM/YYYY format.
 This code works for invalid dates also but gives answer accordingly
 e.g., 32/12/2020 will be assumed as 01/01/2021

Formula

Day is determined by counting no. of odd days.

Let N be the no. of odd days.

If N = 0, then Sunday

If N = 1, then Monday

If N = 2, then Tuesday

If N = 3, then Wednesday

If N = 4, then Thursday

If N = 5, then Friday

If N = 6, then Saturday

N is given by,

N = (K + [ 2.6M - 0.2 ] + D + [ D/4 ] + [ C/4 ] - 2C ) mod 7,

where K = day, C = Centuries passed, D = year, M = month, [x] is Greatest Integer less than or equal to x. More details of this formula can be found at here

About

code (written in C) to check day by entering Date in DD/MM/YYYY format

Topics

Resources

License

Stars

Watchers

Forks

Languages