Get Day from Date: Simple Ways & Formulas
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This guide shows you several reliable ways to get the day of the week from any date. You’ll learn quick spreadsheet formulas, a simple mental math trick, and the underlying algorithm, so you can find a weekday whether you’re at a computer or not.
Formula
The calculator above uses a variation of Zeller’s congruence, a well-known algorithm for finding the day of the week. The formula is:
h = (d + floor((13*(m+1))/5) + K + floor(K/4) + floor(J/4) - 2*J) mod 7
Where:
- d = day of the month (1 to 31)
- m = month (3 = March, 4 = April, …, 14 = February; January and February are counted as months 13 and 14 of the previous year)
- K = year of the century (year mod 100)
- J = zero-based century (floor(year/100))
- h = day of the week (0 = Saturday, 1 = Sunday, 2 = Monday, …, 6 = Friday)
In our calculator, we’ve adapted it to output 0 for Sunday, which is more common in English-speaking contexts. The expression uses the Gregorian calendar, which is the standard in most of the world today.
Worked Example
Let’s find the day of the week for August 15, 2024 (the default values in the calculator).
- Since August is month 8 (not January or February), we use m = 8, d = 15, y = 2024.
- K = 2024 mod 100 = 24
- J = floor(2024/100) = 20
- Plug into the formula: h = (15 + floor((13*(8+1))/5) + 24 + floor(24/4) + floor(20/4) – 2*20) mod 7
- Simplify: h = (15 + floor(117/5) + 24 + 6 + 5 – 40) mod 7 = (15 + 23 + 24 + 6 + 5 – 40) mod 7 = 33 mod 7
- 33 mod 7 = 5 (since 7*4=28, remainder 5).
- In our output mapping, 0=Sunday, 1=Monday, …, 5=Friday. So August 15, 2024 is a Friday.
You can verify this with any calendar – it’s indeed a Friday.
Why You Might Need This
Knowing the day of the week for a past or future date is useful in many everyday situations:
- Planning events: “Is the 20th a weekend?”
- Historical research: “What day did the Declaration of Independence fall on?” (July 4, 1776, was a Thursday).
- Calculating age in weeks or weekdays for billing or payroll.
- Finding the next occurrence of a specific weekday (e.g., “next Friday the 13th”).
- Understanding calendar patterns, like why certain dates seem to shift.
While most people can look at a phone or computer, there are times when a quick mental or formula-based answer is more convenient.
How to Get the Day in Excel and Google Sheets
If you have a date in a spreadsheet, there are two straightforward functions:
- WEEKDAY(date, [return_type]): Returns a number. With return_type 1 (default), 1=Sunday, 2=Monday, etc. With return_type 2, 1=Monday, 2=Tuesday, etc., which is often more intuitive.
- TEXT(date, “dddd”): Returns the full name of the day (e.g., “Friday”). In Google Sheets, the same function works:
=TEXT(A1, "dddd").
For example, if cell A1 contains the date 2024-08-15, then =TEXT(A1, "dddd") will return “Friday”. To get a short name like “Fri”, use "ddd".
How to Get the Day in Python and Other Languages
In Python, using the built-in datetime module:
from datetime import datetime
date_str = "2024-08-15"
dt = datetime.strptime(date_str, "%Y-%m-%d")
print(dt.strftime("%A")) # Output: Friday
The %A directive gives the full weekday name; %a gives the abbreviated name. In JavaScript, you can use new Date('2024-08-15').toLocaleDateString('en-US', { weekday: 'long' }) which returns “Friday”. Most programming languages have similar date libraries that handle this automatically.
Common Mistakes and Pitfalls
When calculating the day of the week manually or with formulas, watch out for these issues:
- January and February: In Zeller’s congruence, treat January and February as months 13 and 14 of the previous year. If you forget, your result will be off by one day for those months.
- Leap years: The formula accounts for leap years, but if you’re doing mental math, forgetting that a leap year adds an extra day can throw you off.
- Century years: Years divisible by 100 are not leap years unless also divisible by 400. The year 1900 was not a leap year, but 2000 was.
- Calendar system: Zeller’s congruence works for the Gregorian calendar, which was adopted at different times in different countries. For dates before a country’s adoption, you’d need the Julian calendar.
- Date format: When using spreadsheet functions, ensure your date is recognized as a date, not text. If it’s text, the function may return an error.
Limitations and Alternatives
Zeller’s congruence is reliable for any Gregorian date, but it’s not the only method. The Doomsday algorithm, invented by John Conway, is a faster mental method once you learn it. It relies on memorizing that certain dates (like 4/4, 6/6, 8/8, 10/10, 12/12, and 5/9, 9/5, 7/11, 11/7) always fall on the same day of the week in a given year.
For most practical purposes, using a digital calendar or a spreadsheet function is the easiest and least error-prone. The manual formulas are valuable when you need to understand the logic or when you don’t have a device handy.
Frequently Asked Questions
How do I get the day of the week from a date in Excel?
Use the TEXT function: =TEXT(A1, "dddd") to get the full name (e.g., “Friday”) or =TEXT(A1, "ddd") for the abbreviation. Alternatively, use WEEKDAY(A1, 2) to get a number where 1=Monday, 2=Tuesday, etc.
What is the easiest mental trick to find the day of the week?
Learn the Doomsday algorithm. It requires memorizing a few anchor dates and a simple calculation for the year. It takes practice, but once mastered, you can compute any date in seconds.
Why does the formula treat January and February differently?
In Zeller’s congruence, the month is counted starting from March. This is because in the old Roman calendar, March was the first month. By shifting January and February to months 13 and 14 of the previous year, the leap-day adjustment works correctly.
Does this work for dates before the Gregorian calendar was adopted?
No, Zeller’s congruence is for the Gregorian calendar. For dates before a country’s switch (e.g., before 1752 in Britain and its colonies), you’d need a Julian calendar version. The difference is about 10-13 days depending on the century.
Can I get the day of the week from a date in Google Sheets?
Yes, the same functions work: =TEXT(A1, "dddd") or =WEEKDAY(A1, 2). Google Sheets also has a WEEKDAY function with the same syntax.
What if I have a date as a string like “15/08/2024”?
In Excel, you may need to ensure it’s a proper date. You can use DATEVALUE("15/08/2024") to convert it, then apply the TEXT or WEEKDAY function. In Python, specify the format in strptime like %d/%m/%Y.
Related
Formula used
in d | Day | - | 15 | 1 in m | Month | - | 8 | 1 in y | Year | - | 2024 | 1 out dow | Day of week (0=Sun) | - | (floor((y - (m < 3)) / 4) + y - (m < 3) + floor((y - (m < 3)) / 400) - floor((y - (m < 3)) / 100) + floor((13 * (m + (m < 3 ? 12 : 0)) + 8) / 5) + d) % 7 | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.