How We Calculate

Every DateTimeCalcs result comes from one shared set of date and time functions that runs in your browser and follows published calendar and clock rules. This page sets out those rules, the automated tests that check them before every build, and the sources. The code and the tests are written by Elizabeth K. Boone.

Time zones and daylight saving time

Your device supplies the time zone, and your browser’s own time zone database supplies its offsets and clock changes. “Today,” “midnight” and every countdown therefore follow your local calendar, and each calculator names the zone it found, for example America/Chicago (CDT).

Durations are real elapsed time. When a range crosses a daylight saving time (DST) change, the result differs by 1 hour from the gap between the two clock readings, and the calculator adds a note. In New York on November 1, 2026, the 3 clock hours from midnight to 3:00 AM hold 4 hours of real time, because 1:00 to 2:00 AM happens twice. Two edge cases have fixed answers:

  • A clock time that does not exist, because clocks sprang forward past it, moves forward by the length of the gap.
  • A clock time that happens twice, because clocks fell back, counts as its first occurrence.

Calendar rules

Dates follow the Gregorian calendar, the civil calendar of the United States.

  • Leap years are the years that divide by 4, minus the century years that do not divide by 400. 2000 and 2028 have 366 days; 1900 and 2100 have 365.
  • Week numbers follow ISO 8601. Weeks start on Monday, and week 1 is the one that holds the year’s first Thursday, which places January 1, 2027 in week 53 of 2026.
  • Adding months keeps the day of the month, or falls back to the last day of a shorter month. January 31, 2027 plus 1 month is February 28, 2027.
  • A February 29 birthday is celebrated on February 28 in common years unless you choose March 1.

Counting rules

Count Rule used on DateTimeCalcs
Days between dates The start date counts and the end date does not, unless “include end date” is on. Monday to Friday of one week is 4 days.
Business days Monday to Friday, minus the 11 U.S. federal holidays on the days they are observed. A switch counts plain weekdays instead.
Days left in the year Days after today through December 31, so December 31 shows 0. A second figure counts today too.
Day of the year January 1 is day 1.
Countdowns To 12:00 AM local time at the start of the target date.

Leaving out the end date matches how most calendars and contracts measure a gap. Including it fits ranges where every day is used, such as the last day of a trip.

The 11 holidays are the ones listed in 5 U.S.C. 6103(a): New Year’s Day, Martin Luther King Jr. Day, Washington’s Birthday, Memorial Day, Juneteenth, Independence Day, Labor Day, Columbus Day, Veterans Day, Thanksgiving Day and Christmas Day. Following the Office of Personnel Management (OPM) holiday rules, a holiday that falls on a Saturday is observed the Friday before and one on a Sunday the Monday after. New Year’s Day 2028 is a Saturday, so it is observed on Friday, December 31, 2027. State and local holidays, Inauguration Day (a holiday only around Washington, D.C.) and one-off closings by executive order, such as an extra day off on Christmas Eve, are not removed.

Clock conventions

12:00 AM is the midnight that starts a day and 12:00 PM is noon, as on U.S. digital clocks. Because the National Institute of Standards and Technology (NIST) warns that both labels are easily confused, every page that shows clock times can switch to a 24-hour display, where midnight is 00:00. Decimal hours are rounded to 2 places, so 8 hours 30 minutes is 8.50 hours and 8 hours 20 minutes is 8.33.

Holiday and season dates

No holiday date is typed in by hand. Each one is computed from its legal or customary rule every time the site is built. Thanksgiving is the fourth Thursday of November under 5 U.S.C. 6103, and Black Friday is the day after it. Easter is the first Sunday after the ecclesiastical full moon on or after March 21, worked out with the Gregorian algorithm that Western churches use.

Season countdowns end at the moment of the equinox or solstice. Those moments come from the method in Jean Meeus’s Astronomical Algorithms (chapter 27) and agree with NASA JPL Horizons to within 30 seconds for 2026 through 2028. Pages round them to the nearest minute, so a time can differ by 1 minute from a printed almanac.

How results are tested

More than 300 automated tests compare the code’s output with known answers, including OPM’s 2026 holiday schedule, published Easter dates and solstice times from JPL Horizons. The tests run before every build, and a single failure stops the build, so a page cannot go live with a result the tests reject. These cases are among them:

What is checked Input Expected answer
Same-day span 9:00 AM to 5:30 PM 8 hours 30 minutes, or 8.50 decimal hours
Overnight span 10:00 PM to 6:00 AM 8 hours, marked overnight
Unpaid break 9:00 AM to 5:30 PM, less 30 minutes 8 hours
Adding durations 1:45 + 2:30 4:15
Weekly time card Monday to Friday, 8:00 AM to 5:00 PM, 30-minute breaks 42:30, with 2:30 over 40 hours
Year lengths 2026 and 2028 365 and 366 days
Thanksgiving 2026 and 2027 November 26 and November 25
Black Friday 2026 November 27
Easter 2026 and 2027 April 5 and March 28
December solstice 2026 20:50 UTC on December 21 (Horizons: 20:50:15)
Adding days 90 days after October 21, 2026 Tuesday, January 19, 2027
Month end January 31, 2027 plus 1 month February 28, 2027
Business days in a range October 21 to December 31, 2026 71 days, of which 48 are business days once Veterans Day, Thanksgiving and Christmas are removed
Business days in a year 2026 250: 261 weekdays minus 11 federal holidays
ISO week January 1, 2027 Week 53 of 2026
Leap-day birthday February 29 birthday in 2027 February 28 by default
Year end Days left on December 31 0, not counting today

Sources and corrections

Each page lists the sources for its rules, with the date they were last checked. NIST covers daylight saving time and the meaning of 12 AM and 12 PM, while federal law and OPM cover holiday dates. NASA covers the history of leap days, and the ISO 8601 standard covers week numbers.

A page’s “Updated” date changes only when someone reviews its content. To report a result that looks wrong, write through the contact page and include the page address, which already holds your inputs.

Last updated