Write a function that calculates the day of the week for any particular date in the past or future. A typical application is to calculate the day of the week on which someone was born or some other special event occurred.
Following is a simple function suggested by Sakamoto, Lachman, Keith and Craver to calculate day. The following function returns 0 for Sunday, 1 for Monday, etc.
Output : 1 (Monday)
See this for explanation of the above function.
This article is compiled by Dheeraj Jain and reviewed by GeeksforGeeks team. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find the day of the week after K days from the given day
- Python program to find day of the week for a given date
- Tomohiko Sakamoto's Algorithm- Finding the day of the week
- Print day of week using Gregorian Calendar in java
- Find the day number in the current year for the given date
- Zeller's Congruence | Find the Day for a Date
- Date after adding given number of days to the given date
- C++ Program to print current Day, Date and Time
- How to get Day, Month and Year from Date in Java
- PHP | Number of week days between two dates
- Find the number of times every day occurs in a month
- Program to find the time remaining for the day to complete
- Probability of rain on N+1th day
- Problems not solved at the end of Nth day
- Count of days remaining for the next day with higher temperature
- How to calculate the Easter date for a given year using Gauss' Algorithm
- Time Functions in Python | Set-2 (Date Manipulations)
- Date class in Java (With Examples)
- Program to check if a date is valid or not