← Guides

How to add months to a date when the month is shorter

Everyday Tools ·

Add one month to January 31 and you arrive at a date that does not exist: February 31. The same problem appears on the 29th, 30th and 31st, so every date calculator, spreadsheet and programming language has to pick a rule. This guide explains the rule the Everyday Tools date calculator uses, shows that major software makes the same choice, and points out the habit that quietly shifts a monthly date from the 31st to the 28th.

The rule: keep the day if it exists, otherwise use the last day

The Add or subtract days calculator moves years and months first, clamps the result to the last valid day of that month, and only then adds weeks and days. So January 31, 2026 plus 1 month is Saturday, February 28, 2026, while the same start date plus 2 months is Tuesday, March 31, 2026, because March has a 31st. In the leap year 2028, January 31 plus 1 month lands on Tuesday, February 29, 2028. Subtraction follows the same rule: May 31, 2026 minus 1 month is April 30, 2026.

This is not a quirk of one website. Temporal, the date and time standard being added to JavaScript, documents the same choice: its default overflow setting, called constrain, clamps an out of range value to the nearest valid one, and its own example is 2019-01-31 plus one month giving 2019-02-28 [1]. The PostgreSQL manual says a months interval keeps the day of month the same "unless it would be past the end of the new month, in which case the last day of that month is used," and gives the example that March 31 plus 1 month is April 30 while March 31 plus 2 months is May 31 [2]. Java's LocalDate class adds the months, checks whether the date is valid, and if it is not uses the last valid day, so 2007-03-31 plus one month becomes 2007-04-30 [3].

A month is not 30 days

Adding 1 month and adding 30 days are different calculations. January 31, 2026 plus 30 days is Monday, March 2, 2026, two days past the February 28 you get by adding a month. If a contract or a prescription says 30 days, enter 30 in Days; if it says one month, enter 1 in Months. When a document is unclear, ask which was meant; the answers can differ by a day or two.

Months first, then days

When one calculation mixes months and days, the order matters. The calculator applies years and months, clamps, and then adds weeks and days, the same order the PostgreSQL manual describes for its months and days fields [2]. January 30, 2026 plus 1 month and 1 day is Sunday, March 1, 2026: first to February 28, then one more day. Adding the day first would give January 31 and then February 28, a different answer.

Why a repeating monthly date drifts

The clamp only moves a date backward, and nothing moves it forward again. Tick Repeat on the calculator, set Number of dates to 3 and add 1 month from January 31, 2026: the list reads February 28, March 28 and April 28, because each date starts from the previous result. Add 1, 2 and 3 months from January 31 in three separate calculations instead and you get February 28, March 31 and April 30. Reversing a step does not undo it either: January 31 plus 1 month is February 28, and February 28 minus 1 month is January 28. Twelve repeated months from January 31, 2026 end on January 28, 2027, three days short of a full year.

For a payment or billing date that should stay at the end of the month, count from the original date each time (3 months from January 31, not 1 month from the last result), or define the date as "the last day of the month" rather than "the 31st." Regulation Z's official commentary on credit card statements treats those as two different things: a due date must generally be the same numerical date each month, such as the 25th, but a due date set as the last day of each month is allowed even though it falls on February 28 (or 29 in a leap year) and on August 31 [4].

Spreadsheets

Excel's EDATE function "returns the serial number that represents the date that is the indicated number of months before or after a specified date," and the examples on Microsoft's support page all start on the 15th of the month, so they never reach the short month case [5]. If a spreadsheet drives your schedule, test it once with January 31 and compare the result with the calculator before you rely on it.

Try it

  1. Open the Add or subtract days calculator and enter 1/31/2026 as the Start date.
  2. Leave Add or subtract on Add, set Months to 1 and Days to 0, then choose Calculate new date. The result says "Added 1 month." and shows Saturday, February 28, 2026.
  3. To see the drift, tick Repeat, set Number of dates to 3 and calculate again. Each line starts from the one before it.
  4. To avoid it, leave Repeat off and change Months to 2 or 3, so each result is counted from the original date.

Sources

Explore all four tools