How Timespanly calculates

Every calculator on Timespanly uses the same date and time code, and that code has to pass its tests before any change goes live. This page lists the rules it follows, with real examples, so you can check a result by hand.

By Hassaan Rasheed. Published , updated .

Dates follow the calendar, not averages

Each date is turned into a count of days, the math is done in whole days, and the count is turned back into a date. Month lengths and leap years come from the calendar itself. A year is never treated as 365 days or a month as 30.

Feb 28, 2027 to Mar 1, 2027 is 1 day. Feb 28, 2028 to Mar 1, 2028 is 2 days, because 2028 is a leap year. A year is a leap year when it divides by 4, except century years, which must divide by 400. So 2000 was a leap year and 2100 will not be.

Adding months to the end of a month

When the day you start on does not exist in the month you land in, the result moves to the last day of that month, and the calculator tells you it did.

  • Jan 31, 2027 plus 1 month is Feb 28, 2027. February 2027 has only 28 days, so the date moves to the last day of the month.
  • Mar 31, 2026 minus 1 month is Feb 28, 2026. February 2026 has only 28 days, so the date moves to the last day of the month.

Counting the days between two dates

There are two common ways to count, and the calculators show both. The main result is the exclusive count, which is the end date minus the start date. The inclusive count adds one because it counts both the first and the last day, which is how people count the days of a trip or an event.

FromToExclusiveInclusive
Oct 5, 2026Oct 6, 20261 day2 days
Oct 5, 2026Nov 4, 202630 days31 days

The days between dates calculator uses these counts. Its weekday count skips Saturdays and Sundays but not public holidays.

Years, months and days

A span in years, months and days counts whole months first, then the days left over. A whole month is reached when adding that month to the start date lands on or before the end date, using the same month-end rule as above. That is why two spans with the same number of days can show different months.

  • Jan 31, 2027 to Feb 28, 2027 is 1 month.
  • Jan 31, 2027 to Mar 1, 2027 is 1 month, 1 day.
  • Oct 5, 2026 to Dec 25, 2027 is 1 year, 2 months, 20 days.

Spreadsheet functions such as DATEDIF count months differently, so they can differ by a month near the end of a month.

Days from a date

"N days from" a date treats the start date as day 0, so the result is the date you reach after N full days.

  • 14 days from Monday, October 5, 2026 is Monday, October 19, 2026.
  • 30 days from Monday, October 5, 2026 is Wednesday, November 4, 2026.
  • 60 days from Monday, October 5, 2026 is Friday, December 4, 2026.

Pages that depend on today's date, such as the days from today calculator, use the date on your device.

Times and durations

When you enter only times, an end time earlier than the start time is read as the next day. 10:00 PM to 6:00 AM is 8 h 0 min. When you enter dates as well, an end before the start gives a negative result with a note, instead of a guess.

Decimal hours are rounded to two places: 8 h 30 min is 8.5 hours and 7 h 20 min is 7.33 hours. Total minutes are shown as whole minutes. The time duration calculator follows these rules.

Adding and subtracting lengths of time

A length of time can be typed in several ways, and each is read the same way: 1:45, 1h 45m and 1.75 h are all 1 h 45 min. A plain number is read as minutes, so 90 is 1 h 30 min. Minutes after a colon must be 0 to 59.

Every line is turned into seconds, added or subtracted, and the total is turned back into hours and minutes. 2:45 + 1:30 - 0:30 is 3 h 45 min. Totals are never wrapped around a 24-hour clock: 14 h + 13 h is 27 h 0 min, not 3 h. A total below zero keeps its minus sign. The add and subtract time calculator uses these rules.

Hours worked in a shift or week

Each day's hours are the time from start to end minus the unpaid break. 9:00 AM to 5:30 PM with a 30-minute break is 8 h 0 min. A shift that ends earlier than it starts is read as running past midnight. A break longer than the shift is shown as an error instead of a negative day.

The week total adds the days worked. Hours above 40 in a week are shown separately because that is the usual US overtime line, but the calculator does not work out overtime pay, which depends on your state and your employer. The hours calculator uses these rules.

Time zones and daylight saving

By default, times are wall-clock times with no time zone, which is what most people mean by "9:15 to 5:45". Choose a time zone and the calculator measures the real time that passed, including daylight saving changes. Time zone rules come from the time zone database built into your browser.

SpanWall clockAmerica/New_York
12:30 AM to 3:30 AM, Nov 1, 2026 (clocks fall back)3 h 0 min4 h 0 min
1:30 AM to 3:30 AM, Mar 14, 2027 (clocks spring forward)2 h 0 min1 h 0 min

Two cases need a rule. When clocks fall back, a time such as 1:30 AM happens twice, and the calculator uses the first one. When clocks spring forward, a time such as 2:30 AM never happens, and the calculator moves it forward by the hour that was skipped, to 3:30 AM. Either way, the result carries a note.

Business days

Business days are Monday to Friday. Public holidays are not skipped, because they differ by state and by employer, so add them yourself for a legal or financial deadline. The start date is not counted, so Friday plus 1 business day is the next Monday: Oct 12, 2026.

From Oct 5, 2026 to Oct 9, 2026 is 4 business days, or 5 if you count the start date as well.

Week numbers

Week numbers follow ISO 8601: weeks start on Monday, and week 1 is the week with the year's first Thursday. Oct 5, 2026 is in week 41 of 2026. Jan 1, 2027 belongs to week 53 of 2026, because that week started in 2026.

Negative results

A result below zero is shown with a minus sign and a note. It is never hidden or turned into zero.

How the code is tested

The tests run before every release. They include every example on this page, plus a check of each day from Jan 1, 1900 to Dec 31, 2100 against a second, independent calendar. If a result looks wrong to you, please tell me what you entered.