EpochLab

Ranges & durations

Time arithmetic that admits months are not 30 days

The exact elapsed milliseconds and the calendar difference a human would state are both correct, and different. You get both, plus the daylight-saving transitions that make them disagree.

Two ways to measure a gap

Give the page a start and an end. You can type a date, a date and time, a timestamp, or a word like now. It then measures the gap in two ways, and shows both.

The first is the exact time that passed, down to the millisecond. The second is the gap as a person would say it: 1 year, 2 months and 3 days. These can disagree. A month can be 28 to 31 days long, and a day with a clock change is 23 or 25 hours. So the page lists every clock change inside your range, too.

You also get the same gap in every unit, from weeks down to seconds, and a count of each weekday in the range. Units that depend on month or year length are marked as rough, since those lengths vary.

The second mode adds or takes away a span. Start from any moment, pick a number of years, months, days, hours or minutes, and see where you land, in your zone and as a Unix timestamp.

Questions people ask

Why do the exact and calendar answers differ?

Because calendar units are not fixed. One month after 31 January is the end of February, not 31 days later. A night with a clock change is an hour short or long. Both answers are right; they answer different questions.

Which time zone does it use?

Your own, unless you pick another. The zone only matters for calendar maths, such as where a day starts and when the clocks change. The exact elapsed time is the same in every zone.

What happens if I add a month to 31 January?

You get the last day of February. Months are added on the calendar, and a date that does not exist is moved back to the end of the shorter month. Weeks and smaller units are added as exact time.

Can I share a range?

Yes. The start, end and zone are kept in the address bar, so a copied link opens on the same range.