Weekday Count in Date Range Calculator

Weekday Count in Date Range Calculator

Leading AI Skill PRO

Enter Calculation

Formula

Count(w)=⌊N7⌋+[(w−w0)mod7<(Nmod7)]where{N=(Serialend−Serialstart)+1start=Start Yr/Mo/Dayend=End Yr/Mo/Dayw0=weekday of start date\begin{gathered} \text{Count}(w) = \left\lfloor \frac{N}{7} \right\rfloor + \bigl[\,(w - w_0) \bmod 7 < (N \bmod 7)\,\bigr] \\[1.5em] \text{where}\quad \left\{ \begin{aligned} N &= (\text{Serial}_{\text{end}} - \text{Serial}_{\text{start}}) + 1 \\ \text{start} &= \text{Start Yr}/\text{Mo}/\text{Day} \\ \text{end} &= \text{End Yr}/\text{Mo}/\text{Day} \\ w_0 &= \text{weekday of start date} \end{aligned} \right. \end{gathered}
Usage stats

Advertisement

Results

Total days in period (inclusive)
1
days
Weekday Count
Mondays 0
Tuesdays 0
Wednesdays 1
Thursdays 0
Fridays 0
Saturdays 0
Sundays 0

Report an error on this page

What this calculator does

The Weekday Count in Date Range Calculator tells you how many Mondays, Tuesdays, Wednesdays, Thursdays, Fridays, Saturdays and Sundays fall between two dates, counting both endpoints (inclusive). It also reports the total number of days in the period. This is handy for shift planning, payroll, counting working days, or simply answering "how many Fridays are there this year?"

A calendar date range with each weekday tallied into seven labeled buckets
Each day in the selected range is sorted into one of seven weekday buckets, Monday through Sunday.

How to use it

Pick a start date and an end date using the year, month and day fields. Leave the calendar set to "Western (CE/Gregorian)" for ordinary dates. An optional Japanese-era mode (Meiji, Taisho, Showa, Heisei, Reiwa) is offered as a convenience: when chosen, the year you enter is treated as the era-year and converted to its Gregorian equivalent before any math is done. The underlying date arithmetic is universal and not specific to any country.

The formula

Each date is converted to a day serial number. The inclusive day count is \(\text{totalDays} = \text{endSerial} - \text{startSerial} + 1\). Since a week has seven days, every weekday occurs at least \(\text{baseline} = \text{totalDays} \mathbin{\text{div}} 7\) times. The leftover \(\text{remainder} = \text{totalDays} \bmod 7\) days are the extra occurrences; they are assigned consecutively starting from the start date's weekday. The weekday of any Gregorian date is found with Sakamoto's algorithm.

$$\begin{gathered} \text{Count}(w) = \left\lfloor \frac{N}{7} \right\rfloor + \bigl[\,(w - w_0) \bmod 7 < (N \bmod 7)\,\bigr] \\[1.5em] \text{where}\quad \left\{ \begin{aligned} N &= (\text{Serial}_{\text{end}} - \text{Serial}_{\text{start}}) + 1 \\ \text{start} &= \text{Start Yr}/\text{Mo}/\text{Day} \\ \text{end} &= \text{End Yr}/\text{Mo}/\text{Day} \\ w_0 &= \text{weekday of start date} \end{aligned} \right. \end{gathered}$$
Advertisement
Diagram showing total days split into full weeks plus a remainder
Total days divide into whole weeks (each weekday gets one) plus a remainder that adds one to the first few weekdays.

Worked example

From 2024-01-01 (a Monday) to 2024-12-31 (a Tuesday): 2024 is a leap year, so \(\text{totalDays} = 366\).

$$\text{baseline} = 366 \div 7 = 52, \quad \text{remainder} = 366 \bmod 7 = 2$$

Starting at Monday, the first two weekdays (Monday and Tuesday) each get \(+1\). Result: 53 Mondays, 53 Tuesdays, and 52 of every other weekday — which sum to 366.

Weekday Counts for Common Date Ranges

Counting is inclusive of both the start and end dates. Any range of N days contains \(\lfloor N/7 \rfloor\) of every weekday, plus one extra occurrence for each of the first \(N \bmod 7\) weekdays, starting with the weekday of the start date.

Range Total days Mon Tue Wed Thu Fri Sat Sun
Any single week (7 days) 7 1 1 1 1 1 1 1
Common year, 2023-01-01 to 2023-12-31 (starts Sunday) 365 52 52 52 52 52 52 53
Leap year, 2024-01-01 to 2024-12-31 (starts Monday) 366 53 53 52 52 52 52 52
31-day month, e.g. January 2024 (starts Monday) 31 5 5 5 4 4 4 4
28-day February, e.g. February 2023 28 4 4 4 4 4 4 4

Which weekdays get the extra occurrence?

  • Remainder 0 (7, 14, 28 days, and so on): no extra, every weekday appears equally.
  • Remainder 1 (e.g. 365 days): only the start weekday appears one extra time. 2023 began on a Sunday, so it has 53 Sundays.
  • Remainder 2 (e.g. 366 days): the start weekday and the next one. 2024 began on a Monday, so Monday and Tuesday get 53.
  • Remainder 3 (e.g. a 31-day month): the start weekday and the next two. A month starting on Monday has five Mondays, Tuesdays and Wednesdays.
  • Remainder 1 to 6 in general: the first that many weekdays counted from the start weekday occur once more than the baseline.

A 30-day month has remainder 2, so the start weekday and the following one occur five times.

Key Terms

Inclusive counting
Both the start date and the end date are counted. From the 1st to the 7th of a month is 7 days, not 6, so \(N = \text{Serial}_{\text{end}} - \text{Serial}_{\text{start}} + 1\).
Day serial number
A continuous count of days from a fixed reference date. Subtracting two serial numbers gives the number of days between two dates without month or leap-year bookkeeping.
Baseline (totalDays div 7)
The integer quotient \(\lfloor N/7 \rfloor\). This is the number of times every weekday occurs in the range.
Remainder (totalDays mod 7)
The leftover \(N \bmod 7\), a value from 0 to 6. It is the number of weekdays that occur one extra time.
Start weekday offset
The position of a weekday \(w\) relative to the weekday \(w_0\) of the start date, \((w - w_0) \bmod 7\). A weekday gets the extra occurrence when this offset is smaller than the remainder.
Proleptic Gregorian calendar
The Gregorian calendar rules (leap years every 4 years, except century years not divisible by 400) extended backward to dates before the calendar was actually adopted in 1582. Such dates may differ from historical records made under the Julian calendar.
Sakamoto's algorithm
A compact method for finding the weekday of a Gregorian date. It uses a small month-offset table, subtracts 1 from the year for January and February, and computes \((y + \lfloor y/4 \rfloor - \lfloor y/100 \rfloor + \lfloor y/400 \rfloor + t_m + d) \bmod 7\). The result 0 means Sunday.
Advertisement

Interpreting Your Weekday Counts

  • Working days: Adding the Monday to Friday counts gives the calendar working days in the range, assuming a Monday to Friday work week and before subtracting any public holidays.
  • Weekend days: Adding the Saturday and Sunday counts gives the weekend days. Working days plus weekend days always equal the total days.
  • Whole weeks: A range of exactly \(7k\) days contains exactly \(k\) of each weekday, so the weekday counts are all equal.
  • The remainder: If the total is \(7k + r\) with \(0 \le r \le 6\), then \(r\) weekdays occur \(k+1\) times and the rest occur \(k\) times. The extra ones are the first \(r\) weekdays counted from the weekday of the start date.

Example: For 15 days starting on a Wednesday, \(15 = 2 \times 7 + 1\). Every weekday occurs twice, and Wednesday occurs a third time.

Limits: The counts are purely calendar-based. They do not account for public holidays, which differ by country and region, or for work weeks that differ from Monday to Friday (for example, Sunday to Thursday in some countries). Rotating shift patterns and company closures are also not included. Subtract those days yourself when you need an exact count of working days.

FAQ

Is the count inclusive? Yes — both the start and end dates are included. A single day (start = end) gives a total of 1.

What if the start date is after the end date? The dates are swapped automatically so the total is always positive.

Which calendar is used? The proleptic Gregorian calendar throughout. For modern dates this matches the everyday civil calendar exactly; very old dates before 1582 may differ from historical Julian records.

Last updated:

Most popular in Time and Date

View all Time and Date calculators