Duration Calculator
Compute a calendar duration between instants or apply one to a date.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
2024-01-31T00:00:00.000Z to 2024-03-01T00:00:00.000Z is 0 year(s), 1 month(s), 1 day(s), 0:00:00.
How it works
- Measured the span between the two instants with the later instant as the end.
- Counted whole calendar years, then whole calendar months with the day clamped to the target month (so Jan 31 + 1 month is Feb 28/29).
- Counted the remaining whole days, hours, minutes and seconds.
- The direction reflects whether the end is after or before the start.
Methodology
- Parse the start and end (or the applied components) as absolute instants.
- For a span, count whole calendar years and months using real month lengths and day-clamping, then the remaining days and time.
- For an applied duration, add calendar years and months with day-clamping, then the fixed-length weeks, days and time units.
Time model
- Time source: an explicit reference supplied by the visitor.
- Timezone: Instants are absolute and timezone-independent; a date-only input is read as UTC midnight.
- Locale: ISO-8601 instants and durations only; no locale-specific formatting.
- Daylight saving: Spans are measured between absolute instants, so daylight-saving transitions never change the result.
- Reference date: A start instant is required; the end or the applied components are supplied explicitly.
Usage
- Enter the start instant.
- Enter an end instant to measure the duration, or fill in any duration component to apply it.
- Read the calendar breakdown, the totals and the ISO-8601 duration.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Across a leap day
{
"start": "2024-01-31T00:00:00Z",
"end": "2024-03-01T00:00:00Z"
}Across a year boundary
{
"start": "2023-01-31T00:00:00Z",
"end": "2024-03-01T00:00:00Z"
}Apply one calendar month to Jan 31
{
"start": "2024-01-31T00:00:00Z",
"months": 1
}Apply a mixed duration
{
"start": "2026-01-01T00:00:00Z",
"years": 1,
"months": 2,
"days": 3,
"hours": 4,
"minutes": 5,
"seconds": 6
}Limitations
Why months are not 30 days
Calendar months have different lengths. This tool advances by whole months using the real calendar and clamps the day, rather than multiplying a fixed 30-day figure.
Frequently asked questions
- How is Jan 31 plus one month handled?
- The day is clamped to the last valid day of the target month, so Jan 31 plus one month is Feb 29 in a leap year and Feb 28 otherwise.
- Does a daylight-saving change affect the result?
- No. The calculation is on absolute instants; an hour lost or gained to DST is part of the elapsed span, not a separate correction.
Sources
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.