Skip to content

Program for computing Zeller's Congruence", my first GitHub upload

Notifications You must be signed in to change notification settings

Psaa70/Program-for-computing-Zeller_s_Congruence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"Program for computing Zeller's Congruence in C", my first gitHub upload.

This is an interesting algorithm that uses module theory and congruences to compute on what day of the week will a certain date (DD,MM,YYYY) coincide.

Zeller's Congruence

h = (q + ⌊(13(m + 1)) / 5⌋ + K + ⌊K / 4⌋ + ⌊J / 4⌋ - 2J) mod 7

Where:

  • h is the day of the week (0 = Saturday, 1 = Sunday, ..., 6 = Friday)
  • q is the day of the month
  • m is the month (January and February are counted as months 13 and 14 of the previous year) This I will explain later on
  • K is the year of the century (year % 100)
  • J is the zero-based century ( (year / 100))

Why are January and February counted as months 13 and 14 of the previous year?

  • For an easier year transition as the transition between years (from December to January) would require additional logic to handle the change in the year part of the formula.

About

Program for computing Zeller's Congruence", my first GitHub upload

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published