SheepDev

Date, time, and schedules

Is one month after month-end the same as 30 days later?

Tools to use

'Valid for one month' and 'valid for thirty days' sound interchangeable until you start on January 31. The hard part of date arithmetic is choosing what a unit means. Separating months, calendar days, and elapsed time exposes rules that a specification may have left unstated.

Use date addition and date difference to inspect the consequences. These tools do not decide contract terms. First identify whether the rule means the same date next month, next month-end, or a fixed elapsed duration. If the rule is undecided, use the different results to discuss it rather than choosing whichever is convenient.

Add one month and thirty days to January 31

Input instant; keep the comparison zone UTC
2024-01-31T12:00:00Z

With months=1, other amounts zero, UTC, and constrain overflow, the result is February 29, 2024 at noon. There is no February 31, so the date is constrained to the month's last day. From the same source, months=0 and days=30 gives March 1 at noon. Replacing a month with thirty days changes this result by one day.

Change only the year to 2023: one month gives February 28, while thirty days gives March 2. The gap itself varies by year. Averaging month lengths cannot reproduce actual renewal dates. Keep complete dates in comparison notes so the year-dependent distinction remains visible.

Constrain the date or reject the operation?

With reject overflow, adding a month to January 31 fails. That is a policy against silently substituting a nonexistent date, not a broken calculator. Even when constraining is allowed, recognize that the date changed to month-end. 'Unavailable unless next month has a 31st' and 'otherwise use month-end' are different rules.

The same decision arises when adding a year to February 29, 2024: February 2025 has no 29th. Birthdays, renewals, and reporting cutoffs may follow different rules. The tool applies the selected overflow policy without inferring it from the use case.

Two one-month additions can differ from one two-month addition

Compare from January 31, 2024 with constrain overflow
Jan 31 + 1 month = Feb 29
Feb 29 + 1 month = Mar 29
Jan 31 + 2 months = Mar 31

The first adjustment changes the date to the 29th. Reusing that result gives March 29; the operation does not remember an original preference for the 31st. A month-end schedule therefore needs more than repeated additions. Define whether each occurrence is calculated from the original anchor or explicitly selected as month-end.

Subtraction need not restore the source either: January 31 plus one constrained month gives February 29, then minus one month gives January 29. Adjustment lost information. Do not assume arithmetic reversibility; preserve the original date when checking a schedule.

A day later can be less than twenty-four hours later

Source instant, compared in America/New_York
2024-03-09T12:00:00-05:00

In America/New_York, adding one day gives March 10 at 12:00 with offset -04:00, only 23 elapsed hours later. Adding 24 hours instead gives 13:00. Both calculations are valid but preserve different things: local noon for a daily lunch, or elapsed duration for equipment runtime.

Keep the date, zone, and source offset together. Noon UTC and noon New York are different instants. Month overflow policy is also not a choice for ambiguous daylight-saving times. For a booking at the transition itself, inspect missing or repeated wall times in the timezone tool separately.

Read calendar differences separately from elapsed time

Calendar mode reports one day between 2024-03-09 and 2024-03-10. Elapsed mode reports 23 hours, or 82,800 seconds, between 2024-03-09T12:00:00-05:00 and 2024-03-10T12:00:00-04:00. Separate modes avoid inventing a time and zone for date-only input and calling it twenty-four hours.

If both March 9 and March 10 are included, there are two selected dates despite a difference of one day. Those are different questions. For business-day counts, use endpoint inclusion controls rather than treating elapsed or calendar differences as a count of included dates.

A deadline needs a rule before a number

Record the source instant, zone, added unit, overflow policy, and recurrence anchor. 'One month later' alone is not enough to reproduce the calculation next month. Test month-end, a leap year, and an offset-transition day to expose differences hidden on ordinary dates.

The tool does not register schedules or retrieve a service's renewal date. When results differ from a service, compare the rules first. Matching source timestamps do not prove the service wrong. Being able to explain the rule matters more than merely obtaining a date.

Monthly recurrence may need the original anchor

Starting from January 31, adding a month to a constrained February result can carry February's day into March. Adding two months to the original anchor instead reaches March 31. Define whether recurrence means every month-end, original day with occasional constraint, or one month after the previous result. Enabling month-end constraint alone does not specify a recurrence rule.

An expiry also needs an endpoint definition: 'through March 31' and 'until March 31 at 00:00' are not the same interval. Attaching a start or end of day to a date-only result changes usable time. Specify zone, endpoint inclusion and subsecond handling in the service contract. Date arithmetic reproduces that rule; it cannot resolve ambiguous wording automatically.

Include month-end, leap-year February and DST boundaries alongside ordinary dates. Record original date, unit, constraint policy and expected result. Round trips can help, but constraining a day can discard information, so adding then subtracting a month need not return the original. Distinguish a defect from the documented consequence of the chosen policy.

Sources

Tools to use

Guides →