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
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Python program to find day of the week for a given date
- Find the day of the week after K days from the given day
- Zeller's Congruence | Find the Day for a Date
- Find the day number in the current year for the given date
- Date after adding given number of days to the given date
- PHP | Number of week days between two dates
- Print day of week using Gregorian Calendar in java
- Tomohiko Sakamoto's Algorithm- Finding the day of the week
- PHP | Converting string to Date and DateTime
- Date class in Java (With Examples)
- Java | Current date and time
- Convert String to Date in Java
- Program to check if a date is valid or not
- Time Functions in Python | Set-2 (Date Manipulations)
- Java | Date format validation using Regex
- C++ Program to print current Day, Date and Time
- Convert timestamp to readable date/time in PHP
- Sort a multidimensional array by date element in PHP
- Program to Convert Milliseconds to a Date Format in Java