Date2Day is a C program that calculates the day of the week for any given date using Zeller's Congruence. It accepts date, month (as a string), and year from the user and outputs the corresponding weekday.
- 📅 Accepts month names like "March", "December", etc.
- ✅ Accurate weekday detection using Zeller's formula
- 🧠 Handles January and February as per the algorithm's rules
- 🖥️ Console-based, beginner-friendly, no extra libraries
- User enters:
- Day (number)
- Year (4-digit)
- Month (as a name, case-sensitive)
- The program uses
strcmp()to convert month name to Zeller format - Applies Zeller’s Congruence to compute the weekday
- Prints the full result (e.g.,
14 June 2025 is Saturday)
h = (q + (13 * (m + 1)) / 5 + k + k / 4 + j / 4 + 5 * j) % 7;Where:
-
h → Day of the week (0 = Saturday, 1 = Sunday, ..., 6 = Friday)
-
q → Day of the month
-
m → Month (3 = March, 4 = April, ..., 12 = December, Jan & Feb are counted as 13 & 14 of previous year)
-
k → Year of the century (year % 100)
-
j → Zero-based century (year / 100)
💡 Example:
gcc Date_to_Day.c -o Date2Day
./Date2DayEnter the date: 14 Enter the year: 2025 Enter the month name: June
14 June 2025 is Saturday
See included LICENSE file for more details.