Get Day Name from Date: 3 Quick Methods
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 page explains how to find the day of the week for any date, whether you need it for planning, history, or curiosity. You can use a simple mental formula, a spreadsheet function, or an online calculator. The most reliable method depends on your context, and this guide covers all three.
Formula
The calculator above uses a simplified version of the Zeller’s congruence. For a date given as YYYY-MM-DD, it computes the day of the week as a number from 0 (Sunday) to 6 (Saturday). The formula breaks the year into century and year-within-century parts, then applies a series of divisions and modulos to account for leap years and month lengths. The exact expression is:
Let y = last two digits of the year, c = first two digits (century), m = month (3=March, 4=April, …, 14=February of the next year), and d = day of month. Then:
h = (d + floor(13*(m+1)/5) + y + floor(y/4) + floor(c/4) - 2*c) mod 7
Here h is 0=Saturday, 1=Sunday, …, 6=Friday. The calculator uses a variation that directly outputs 0=Sunday to 6=Saturday.
Worked Example
Using the default date 2024-03-15:
- Year = 2024, so y = 24, c = 20.
- Month = 3, day = 15.
- Compute: (15 + floor(13*(3+1)/5) + 24 + floor(24/4) + floor(20/4) – 2*20) mod 7
- Simplify: (15 + floor(52/5) + 24 + 6 + 5 – 40) mod 7 = (15 + 10 + 24 + 6 + 5 – 40) mod 7 = 20 mod 7 = 6.
- h = 6 corresponds to Friday (since 0=Saturday, 1=Sunday, 2=Monday, …, 6=Friday).
So March 15, 2024, is a Friday, which matches the calculator’s output.
Why You Might Need the Day of the Week
Knowing the day of the week for a given date is useful in many everyday situations:
- Planning events or meetings – you may need to know if a date falls on a weekend.
- Checking historical dates – “What day of the week was July 4, 1776?”
- Calculating age or tenure – sometimes you need the exact day for legal or HR purposes.
- Setting up recurring reminders – e.g., “every third Tuesday” requires knowing the day.
- Solving puzzles or trivia – many riddles involve day-of-week calculations.
Methods to Get the Day Name
There are several ways to find the day of the week, each with its own trade-offs:
- Mental math (Zeller’s congruence or Doomsday algorithm) – fast once you practice, but error-prone for beginners.
- Spreadsheet functions – in Excel or Google Sheets,
=TEXT(A1,"dddd")returns the full day name, while=WEEKDAY(A1)returns a number. - Online calculators – the one above gives an instant answer with no setup.
- Programming languages – Python’s
datetime.date.weekday(), JavaScript’sgetDay(), etc. - Paper calendars – simple but only works for the current year.
Common Mistakes and How to Avoid Them
When calculating the day of the week manually, people often make these errors:
- Forgetting leap years – February 29 exists only in years divisible by 4, except centuries not divisible by 400.
- Mixing up the starting day – different formulas use different starting days (Sunday vs. Saturday).
- Using the wrong year for January and February – in Zeller’s congruence, January and February are treated as months 13 and 14 of the previous year.
- Rounding errors – floor division must be used, not regular rounding.
To avoid these, double-check your input format and always use integer division (floor) where required.
Limitations of the Formula
The formula works for dates in the Gregorian calendar, which is the standard in most of the world today. It does not work for dates before 1582 (when the Gregorian calendar was introduced) or for countries that adopted it later. For historical dates before the switch, you would need to use the Julian calendar, which has a different leap-year rule. Also, the formula assumes a proleptic Gregorian calendar for dates before 1582, which may not match historical records.
Frequently Asked Questions
How do I get the day name in Excel?
In Excel or Google Sheets, if your date is in cell A1, use =TEXT(A1,"dddd") to get the full day name (e.g., “Friday”) or =TEXT(A1,"ddd") for the abbreviated form (e.g., “Fri”). For a number, use =WEEKDAY(A1) which returns 1 for Sunday, 2 for Monday, etc., depending on the return type.
What is the Doomsday algorithm?
The Doomsday algorithm is a mental math technique that lets you calculate the day of the week for any date using a set of anchor dates that always fall on the same day of the week within a given year. It is faster than Zeller’s congruence once you memorize the anchors and century codes.
Why does the formula treat January and February differently?
In Zeller’s congruence, January and February are counted as months 13 and 14 of the previous year. This is because the formula was designed to make the leap-year calculation simpler. If you use the actual month numbers (1 and 2), the formula gives incorrect results.
Can I use this calculator for dates before 1582?
The calculator uses the Gregorian calendar, which was introduced in 1582. For dates before that, the formula may not match historical records because different regions used the Julian calendar. For most practical purposes, however, the Gregorian calendar is used retroactively for all dates.
How do I convert the number to a day name?
If you have a number from 0 to 6, you can map it to a day name: 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday. This is the standard used by Python’s weekday() method and many other systems.
Related
Formula used
in d | Date (YYYY-MM-DD) | - | 2024-03-15 | 0 out dow | Day of week (0=Sun) | - | (floor((d - floor(d/100)*100 + floor((d - floor(d/100)*100)/4) + floor(floor(d/100)/4) + 5*floor(d/100) + ((d - floor(d/100)*100 + 1 + floor((d - floor(d/100)*100)/4) + floor(floor(d/100)/4) + 5*floor(d/100)) % 7) + 1) % 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.