Boneyard Tools

How the next weekday date is calculated

How the tool finds the day of the week, counts forward to the next target weekday, and lists exact weekly occurrences without calendar drift.

Finding the day of the week first

Before it can find the next Monday, the tool has to know what day the start date falls on. It uses Sakamoto's algorithm, a short formula that returns a number from 0 for Sunday to 6 for Saturday for any Gregorian date. The method leans on a small lookup table of month offsets and a shift for January and February so leap years line up correctly. It is exact and deterministic, which means the same date always yields the same weekday no matter when or where you run it.

Counting forward to the target

Once the start weekday is known, reaching the target is simple modular arithmetic. The tool computes the gap as the target weekday minus the start weekday, wrapped into the range zero to six. A gap of zero means the start date is already the target day. When Include the start date is off, that zero is bumped to seven so the search moves strictly forward to the next occurrence a week later, which is the behavior most people expect from the phrase next Monday.

Adding days without calendar drift

Rather than nudge a Date object forward and risk time-zone or daylight-saving surprises, the tool converts the start date into a continuous day number, adds the gap, and converts back to a year, month, and day. Each further occurrence is just seven more day numbers. Because the conversion is pure integer math, adding weeks never skips or repeats a date, and a result that lands on the first of a new month or the start of a new year comes out exactly right.

Listing a clean run of occurrences

When you ask for several dates, the tool returns the first match and then steps by exactly seven days for each additional one, so the whole list shares the same weekday. Every entry is formatted as an ISO date with zero-padded parts, and the Copy button hands back the list one date per line. That makes it easy to paste a quarter of weekly stand-ups or a run of paydays straight into a sheet or a script.

Frequently asked questions

Why use a day-number conversion instead of a normal date?

Working in continuous day numbers keeps the math pure and free of time-zone or daylight-saving effects. Adding seven day numbers per occurrence guarantees evenly spaced dates and correct rollovers across months and years.

What does a gap of zero mean?

It means the start date already falls on the target weekday. With Include the start date on it is returned as the first result; with it off the tool advances a full week to the next occurrence instead.