Skip to content

Duration Calculator

Runs in your browser

How long between two moments, what a date becomes after adding time to it, and what PT1H30M actually means.

Pick both dates to see how far apart they are

The “Now” buttons work once the page has finished loading.

How this one works

The difference between two dates is given two ways, because both are useful and they disagree. The sentence at the top counts calendar units — years, months and days as a person would say them, which is how Java's Period and Python's relativedelta count. The totals below count elapsed time, which is what a deadline or a bill runs on.

Adding a duration follows the same split: months and days move the calendar (so one month after 31 January is 28 February, and a day later is the same time tomorrow even if the clocks changed overnight), while hours, minutes and seconds are added as exact elapsed time.

Business days count whole Monday to Friday days in the range. Public holidays are not included — they differ by country, and guessing them would be worse than leaving them to you.

Questions

Why do the calendar figure and the total days disagree?
Because months are not a fixed length. From 31 January to 1 March is "1 month and 1 day" on the calendar, but 29 total days in 2026. Neither is wrong — use the calendar reading for how people talk about it, and the totals for arithmetic.
What duration formats are understood?
ISO 8601 (P1Y2M3DT4H5M6S, and P2W for weeks), Java's Duration.toString() including its negative component form (PT-6H-30M), and plain text such as "1d 2h 30m", "90 minutes" or "2 years 6 months".
Does daylight saving affect the result?
Yes, and it is handled. The two dates are turned into instants in the zone you choose, so a range that crosses a clock change has 23 or 25 hours in that day. If a date you pick falls in an hour that never happens, the tool says so.
Are leap years and leap seconds handled?
Leap years, yes — February 2028 has 29 days here. Leap seconds, no: Unix time ignores them, so every minute is 60 seconds, the same assumption your database and language make.

Keyboard shortcuts

Global

  • Show this shortcuts dialogShift?
  • Toggle light / dark themeCtrlShiftL
  • Close dialogsEsc

Formatter & Validator

  • Format JSONCtrlEnter
  • Minify JSONCtrlShiftM
  • Copy outputCtrlShiftC
  • Download output as .jsonCtrlShiftS
  • Clear input and outputCtrlShiftX

Tree Viewer

  • Focus the search box/
  • Expand all nodesCtrlShiftE
  • Collapse all nodesCtrlShiftR

Diff

  • Swap document A and BCtrlShiftS

Time & date tools

  • Use the current time (Epoch Converter)CtrlEnter
  • Copy the main resultCtrlShiftC
  • Clear the inputCtrlShiftX

JSON tools

JSON FormatterPretty-print or minify
JSON ValidatorCheck strict JSON validity
JSON Tree ViewerBrowse JSON as a tree
JSON DiffCompare two documents
JSON Path FinderExplore JSONPath expressions
JSON → CSVFlatten JSON into rows
CSV → JSONTurn rows back into objects

JWT tools

JWT DecoderRead header, payload, claims
JWT VerifierCheck an HMAC signature
JWT Expiry Checkeriat, nbf and exp in local time
JWT GeneratorBuild a signed test token
Base64URL EncoderEncode or decode a segment

Time & date tools

Epoch ConverterTimestamps to real dates
Cron Expression ExplainerCron in plain English
Time Zone ConverterOne moment, many cities
Duration CalculatorDate maths and durations

Code formatters

SQL FormatterBeautify or minify SQL
HTML FormatterBeautify or minify HTML
CSS FormatterBeautify or minify CSS
JavaScript FormatterBeautify or minify JS
Markdown to HTMLConvert with a live preview

Pages

JSON toolsFormat, validate, compare and convert JSON.
JWT toolsDecode, verify and generate JSON Web Tokens.
Time & date toolsConvert timestamps, read cron, compare zones.
Code formattersBeautify and minify SQL, HTML, CSS and JavaScript.
HomePopular tools and categories
All categoriesBrowse tools by category
AboutWhat ToolJar is and why
PrivacyWhat is and is not collected

Theme

Switch to light theme
Switch to dark theme