keepcalculator

06 Numbers and Powers

Convert YN to Days of the Week: Formula Explained

Card No. 06·24549 · Updated · Standard formula, shown below

Weekday number (Sunday=0) 5
Year
2024
You entered
Month
1
You entered
Day of month
1
You entered
You enter
Year, Month, Day of month
You get
Weekday number (Sunday=0)
Rounding
0 dp

To convert a year number, or “YN,” into a day of the week, you need more than the year: enter the month and day as well. This calculator uses the Gregorian calendar to return the weekday for a complete date; a year by itself cannot identify one.

Formula

This calculation applies a Gregorian-calendar weekday formula to a year, month, and day. It returns a number from 0 to 6, where Sunday is 0, Monday is 1, and Saturday is 6. The result is a weekday index, not a weekday name; use the mapping below to read it.

Let y be the year, m the month number (January = 1 through December = 12), and d the day of the month. First calculate:

a = floor((14 − m) / 12)
y′ = y − a
m′ = m + 12a − 2
w = (d + y′ + floor(y′/4) − floor(y′/100) + floor(y′/400) + floor((31m′)/12)) mod 7

The calculator’s expression is an algebraically equivalent form of this Gregorian date algorithm. floor means round down to the nearest whole number, and “mod 7” means take the remainder after division by 7. The input limits check that each number is in a broad calendar range, but they do not validate whether that specific date exists: for example, February 31 is not a valid date. Confirm the calendar date before relying on its result.

  • 0 = Sunday
  • 1 = Monday
  • 2 = Tuesday
  • 3 = Wednesday
  • 4 = Thursday
  • 5 = Friday
  • 6 = Saturday

Worked Example

Using the calculator’s default inputs—January 1, 2024—set y = 2024, m = 1, and d = 1.

  1. a = floor((14 − 1) / 12) = 1.
  2. y′ = 2024 − 1 = 2023, and m′ = 1 + 12(1) − 2 = 11.
  3. floor(2023/4) = 505, floor(2023/100) = 20, and floor(2023/400) = 5.
  4. floor((31 × 11)/12) = floor(28.416…) = 28.
  5. w = (1 + 2023 + 505 − 20 + 5 + 28) mod 7 = 2542 mod 7 = 1.

The result is 1, which maps to Monday. Therefore, January 1, 2024 was a Monday.

Why a Year Alone Is Not Enough

A year does not have one weekday. It contains many dates, and those dates fall on different weekdays. For instance, the first day of a year and its last day are usually not the same weekday. To answer “What day of the week was it in YN?”, specify the exact date, such as March 14, 2024.

Even asking for the weekday of January 1 requires a particular year. The calendar shifts because a common year has 365 days—52 weeks plus one day—while a leap year has 366 days, or two days beyond 52 full weeks. Consequently, the weekday of January 1 in the following year moves forward by one or two days.

How to Use the Calculator

  1. Enter the four-digit year in the Year field.
  2. Enter the month as a number from 1 to 12; do not enter its name.
  3. Enter the day of the month, then check that the date exists in that year.
  4. Read the output as an index and match it to the Sunday-through-Saturday list.

For example, use 7 for July, not 07/01/2024 as a single input. The calculator expects three separate values, so entering a full date in one field will not produce the intended result.

Calendar System and Date Limits

This formula is for the Gregorian calendar, the civil calendar used in most countries today. It accounts for the Gregorian leap-year rule: a year divisible by 4 is generally a leap year, except century years, which must also be divisible by 400. Thus 2000 was a leap year, while 1900 was not. That exception is why a simple “every four years” rule can give the wrong weekday for dates around century years.

Calendar conventions matter for older dates. The Gregorian calendar was adopted at different times in different places, and dates before local adoption may be recorded under the Julian calendar or described using a proleptic Gregorian calendar (the Gregorian rules extended backward). This calculator applies Gregorian rules consistently; it does not reproduce historical local calendar transitions. For historical research, check which calendar the source uses.

Common Mistakes and Limits

  • Using only a year: A year alone does not specify a date, so include month and day.
  • Numbering months from zero: January is 1 and December is 12, not 0 and 11.
  • Assuming every year divisible by four is leap: Century years follow the additional divisible-by-400 rule.
  • Entering an impossible date: The field limits do not catch every invalid month-day combination. February has 28 days in a common year and 29 in a leap year; other months have either 30 or 31.
  • Confusing the index with a name: A result of 0 means Sunday in this calculator, not Monday or “day zero” in every convention.

The formula gives a weekday, not a time-zone-adjusted timestamp. Time zones can affect which local calendar date an event belongs to, but once the intended local date is chosen, the weekday calculation itself does not need a time or location.

Frequently Asked Questions

Can I convert a year number (YN) directly to a weekday?
No. A year has many weekdays. You need a full date: year, month, and day.

What does a result of 0 mean?
In this calculator, 0 means Sunday. The values continue in order through 6 for Saturday.

Does the calculator account for leap years?
Yes. Its Gregorian formula includes the century and 400-year corrections that determine leap-year behavior.

Why might a historical date have a different weekday in another source?
Sources may use different calendar systems or apply Gregorian dates backward in time. Check whether the date is Julian, Gregorian, or based on a local historical calendar.

Can the calculator tell me whether a date is valid?
Not completely. It restricts year, month, and day to broad numeric ranges, but you must check month lengths and leap years yourself; for example, April 31 is invalid.

Related

Formula used
in y | Year | - | 2024 | 1 | 9999
in m | Month | - | 1 | 1 | 12
in d | Day of month | - | 1 | 1 | 31
out w | Weekday number (Sunday=0) | - | (floor((14-m)/12)*12 + m - 2 + d + y - floor(y/100) + floor(y/400) + floor((y-1)/4) - floor((y-1)/100) + floor((y-1)/400)) % 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.

More cards in this drawer

The whole Numbers and Powers drawer →