# What date is it before or after a date?

Adds or subtracts years, months, weeks, and days to a date, or counts the time between two dates in years, months, days, and working days.

- Page: https://www.acalculator.org/days/date-calculator
- JSON spec: https://www.acalculator.org/days/date-calculator.json
- Version: 90118d1fa1da

## Default answer

Example with the default inputs (What do you want to do? Add or subtract time, Start date September 29, 2026, Add or subtract? Add, Days 90) on the example date Tuesday, September 29, 2026: From September 29, 2026 to Monday, December 28, 2026: 90 days.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| mode | What do you want to do? | Add or subtract time from a date, or count the time between two dates. |
| start | Start date | The date to start from. Today, unless you change it. |
| op | Add or subtract? | Whether to add the time to the start date or subtract it. |
| years | Years | The number of years to add or subtract. |
| months | Months | The number of months to add or subtract. |
| weeks | Weeks | The number of weeks to add or subtract. |
| days | Days | The number of days to add or subtract. |
| end | End date | The date to count to. |
| includeEnd | Count the end date | Count the end date as one more day. |
| useWorkingDays | Count working days only | Count only working days instead of every calendar day. |
| excludeSaturday | Skip Saturdays | Leave Saturdays out of the count. |
| excludeSunday | Skip Sundays | Leave Sundays out of the count. |
| excludeHolidays | Skip public holidays | Leave the chosen country's public holidays out of the count. |
| country | Country | The country whose public holidays are skipped. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| workDays | Working days | Days from the start date to the end date without the skipped weekend days and public holidays. Negative when the end date is first. |
| span | Time between | The days counted, as whole years, months, and days from the earlier date. It has no sign: see Days for the direction. |
| date | End date | The start date plus or minus the years, months, weeks, and days; when counting between two dates, the end date. |
| totalDays | Days | Calendar days from the start date to the end date (counted as set in count mode). Negative when the end date is first. |
| weeks | In weeks | The calendar days as whole weeks and days, with no sign. |
| note | Note | A note when the end date is before the start date. |

## Method

Add or subtract: move the start date by 12 × years + months calendar months, then by 7 × weeks + days days. Between: count the days from the start date up to the end date (the end date too when asked), without weekends and holidays for working days.

## Assumptions

- Years and months move first, then weeks and days. A day past the end of a shorter month moves to its last day: January 31 plus one month is February 28, or February 29 in a leap year.
- Between two dates, the start date is counted and the end date is counted only with “Count the end date”. When the end date is first, the count is negative.
- Dates are calendar days on the Gregorian calendar with no time of day, so daylight saving changes cannot add or lose a day. The dates you enter run from 1600 to 2400; a result of adding or subtracting can fall outside that range and still shows.
- Public holidays are the days off as observed. Holiday data covers the US from 1986, the UK (England and Wales) from 2019 to 2028, Canada (federal) from 2021, India (central government) from 2023 to 2027, and China from 2015 to 2035.

## Worked examples

1. mode = add, start = 2026-09-27, op = add, days = 90 gives date = 2026-12-26, totalDays = 90. Source: hand calculation in content.mdx; Python: date(2026,9,27) + timedelta(90) = 2026-12-26.
2. mode = add, start = 2026-09-27, op = add, years = 1, months = 2, weeks = 3, days = 4 gives date = 2027-12-22, totalDays = 451. Source: hand calculation in content.mdx: 14 months to 2027-11-27, then 25 days to 2027-12-22.
3. mode = add, start = 2024-01-31, op = add, months = 1 gives date = 2024-02-29, totalDays = 29. Source: hand calculation in content.mdx: February 2024 has 29 days, so the 31st clamps to the 29th.
4. mode = add, start = 2026-03-31, op = subtract, months = 1, days = 1 gives date = 2026-02-27, totalDays = -32. Source: hand calculation in content.mdx: March 31 minus one month is February 28, minus one day is February 27.
5. mode = between, start = 2026-01-01, end = 2026-12-31, includeEnd = no, useWorkingDays = no gives totalDays = 364, span = {"years":0,"months":11,"days":30}, weeks = {"weeks":52,"days":0}. Source: hand calculation in content.mdx; Python: (date(2026,12,31) - date(2026,1,1)).days = 364.
6. mode = between, start = 2026-01-01, end = 2026-12-31, includeEnd = yes, useWorkingDays = no gives totalDays = 365, span = {"years":1,"months":0,"days":0}. Source: hand calculation in content.mdx: 364 days plus the end date.
7. mode = between, start = 2026-01-01, end = 2026-01-31, includeEnd = no, useWorkingDays = yes, excludeSaturday = yes, excludeSunday = yes, excludeHolidays = yes, country = us gives workDays = 20, totalDays = 30. Source: OPM federal holidays 2026 (https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/); hand calculation in content.mdx.
8. mode = between, start = 2026-12-31, end = 2026-01-01, includeEnd = no, useWorkingDays = no gives totalDays = -364, span = {"years":0,"months":11,"days":30}, note = The end date is before the start date, so the count is negative.. Source: hand calculation in content.mdx: the dates swap and the count is negative.

## FAQ

### What is 90 days from today?

Add 90 to today's date, carrying into the next months. From September 27, 2026: 3 days to the end of September, 31 in October, 30 in November, and 26 more in December gives Saturday, December 26, 2026. The page starts with 90 days from today.

### What happens when I add a month to January 31?

There is no February 31, so the date moves to the last day of February: February 28, or February 29 in a leap year. January 31, 2024 plus one month is February 29, 2024.

### In which order are years, months, weeks, and days added?

Years and months first, then weeks and days. So 1 year, 2 months, 3 weeks, and 4 days from September 27, 2026 is 14 months later (November 27, 2027), then 25 days later: December 22, 2027. The order matters only near a month end.

### How many days are there between two dates?

Choose "Count days between dates". The start date counts and the end date does not, unless you turn on "Count the end date". January 1 to December 31, 2026 is 364 days, or 365 with the end date.

### How do I count working days between two dates?

In the count mode, turn on "Count working days only". Saturdays and Sundays are skipped, and you can skip a country's public holidays too. January 1 to 31, 2026 has 20 US working days: the days counted (January 1 to 30) hold 22 weekdays, less New Year's Day and Martin Luther King Jr. Day.

### Does subtracting a month undo adding one?

Not always. January 31 plus one month is February 28 (2026), but February 28 minus one month is January 28. Month lengths differ, so clamped dates do not round-trip.

## Sources

- U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years
- U.S. Office of Personnel Management, Federal Holidays (2026: January 1 and January 19). https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/
- 5 U.S.C. 6103, federal holidays and the weekend rule. https://www.law.cornell.edu/uscode/text/5/6103
- GOV.UK, UK bank holidays (England and Wales). https://www.gov.uk/bank-holidays
- Canada Labour Code, section 166 (general holidays). https://laws-lois.justice.gc.ca/eng/acts/L-2/
