Time Calculator

Calculate, add, subtract, convert, and analyze time instantly with advanced time math tools.

Time tools

Add or subtract two day-hour-minute-second durations with auto-roll-over and overflow handling.

First duration

Second duration

Live preview

2h 15m

8,100,000 ms

Smart productivity suggestions

  • Roughly a long meeting or a travel leg. Build in a 10-minute buffer for context switching and a stretch break midway.

What is a Time Calculator?

A time calculator is a digital workbench for every kind of time arithmetic — adding and subtracting durations, projecting from a real date, parsing free-form expressions, measuring the gap between two moments, converting between every common time unit, calculating payroll hours, and running a live countdown or stopwatch. Where a basic clock just tells you what time it is, a time calculator answers the harder questions: how long is this, when will that happen, how much have I worked, how many minutes until the next sprint ends?

The SamCalculator Time Calculator wraps seven precise modules into a single tool. It's the math behind your project timelines, contract notice periods, vesting cliffs, work-shift payroll, study Pomodoros, sleep-cycle nap windows, retirement countdowns, exam timers, server-log timestamps, and the dozens of small daily questions that start with “how long” or “when”. For related tasks, see the countdown timer, the date difference calculator, the time zone converter, and the all-purpose unit converter.

How Time Calculations Actually Work

Everything is milliseconds

Internally, every moment is represented as the number of milliseconds since 00:00:00 UTC on 1 January 1970 — the Unix epoch. To add or subtract any duration, the calculator converts the input to milliseconds, performs the integer add or subtract, then converts the result back into days, hours, minutes, and seconds. The same approach handles negative durations and arbitrary precision out to the millisecond.

Calendrical year and month walk

Years and months aren't equal length — January has 31 days, February has 28 or 29, May–June straddles 30 and 31. For year/month-aware math the calculator walks whole units forward from the start until the next step would overshoot the end. This is exactly the logic Excel's DATEDIF, Java's Period, and most HR systems use, and it gives the only unambiguous interpretation of '3 months from 31 March'.

DST and leap years are honored

Adding 24 hours in a DST-respecting timezone may return a 23- or 25-hour day on the boundary — and the result is correct, because the wall-clock has actually shifted. The calculator honors that. Leap years follow the full Gregorian rule (every 4 years, except century years not divisible by 400), and the calculation walks through them honestly.

Auto-normalisation

Type 75 minutes and the calculator returns 1 hour 15 minutes. Type 25 hours and you get 1 day 1 hour. Type 90 seconds and it's 1 minute 30 seconds. Auto-normalisation runs on every result, so the digits you see always match how humans speak duration — without changing the underlying millisecond value.

Six Practical Ways to Use This Tool

1

Project schedules

Use the Time Difference module with business-day mode to budget realistic working days between kickoff and a hard delivery date. Layer in US federal holiday exclusion if your team is US-based, and the result is the number that should actually drive the schedule — not the calendar-day count that misleads stakeholders.

2

Shift work and payroll

Drop in your shift start and end (with overnight crossover support), an unpaid break, an overtime-after-N-hours threshold, and an optional night-shift window. The Work Hours module returns regular, overtime, and night-shift hours separately — and an estimated daily and weekly pay at your rate.

3

Pomodoro and deep work

Open the Countdown / Elapsed / Stopwatch module, set a 25-minute target for a Pomodoro sprint, hit Calculate, and a live ticker fills the result card. When the sprint ends, the timer rolls over to count-up so you can see how long the next focused stretch actually lasted.

4

Travel planning

Add a 12h 30m flight duration to your departure time in the Date Math module, pick the destination's timezone, and the result returns the local arrival wall-clock, the day of the week, the ISO 8601 timestamp, and the Unix seconds — useful for booking ground transport and double-checking calendar invites.

5

Expression-style calculation

Type 'release - 2w + 3d - 7h' into the Expression Solver to do quick mental arithmetic without breaking each step into a separate input row. Useful when you're triangulating a buffer before a launch, calculating cumulative engineering time, or sanity-checking a contract clause.

6

Sleep-cycle window

Use the Unit Converter or the Time Difference module to find a wake time that lands on a 90-minute cycle boundary. The productivity panel flags durations that align with sleep-science recommendations (90, 270, 360, 450 minutes) — useful for naps, overnight sleep, and shift-work recovery.

Best Practices for Accurate Time Math

  1. 1

    Decide once whether to count both endpoints

    Notice periods, refund windows, and statutory limits sometimes count both endpoints, sometimes just one. Read the rule, then set the Include Time-of-Day toggle and the start/end inputs to match. Off-by-one errors here are the single biggest source of date-arithmetic disputes.

  2. 2

    Normalise to a single timezone first

    If your start and end live in different zones (start in New York, end in Tokyo), convert them to UTC or a single local reference before comparing — otherwise the millisecond gap silently misreads by an hour or more around DST transitions. The Time Zone Converter handles this in one tap.

  3. 3

    Match the working-day definition to the venue

    US federal banking days, NYSE trading days, UK bank holidays, Japanese national holidays, and your own company calendar are all different. The Time Difference module's Business Days toggle implements US federal holidays via the OPM rules; for other jurisdictions turn off holiday exclusion and adjust manually.

  4. 4

    Be explicit about month length

    Adding '1 month' to 31 January returns 28 (or 29) February — the calculator honors the only unambiguous interpretation, but humans differ. When precision matters, prefer days over months for short windows (under 90 days) and reserve year/month math for longer-horizon contracts and milestones.

Why Accurate Time Tracking Matters

Contracts and statutes turn on it

Statutes of limitations, notice periods, vesting cliffs, lease terminations, and most tax deadlines hinge on exact day-and-hour counts. An off-by-one error in the wrong direction can cost a refund, miss an appeal window, or invalidate a notice — and these are precisely the errors a reliable time calculator removes.

Payroll and labor law depend on it

Overtime, night-shift differentials, statutory rest periods, and union work-rules all build on exact time math. A timesheet that quietly rounds 7h 50m down to 7.5 hours per day costs hundreds of dollars per worker per year — accurate calculation matters for both compliance and fairness.

Productivity systems compound it

Pomodoros, time-blocking, deep-work sprints, and habit stacking all rely on consistent, well-measured time windows. A 25-minute sprint that quietly drifts to 35 minutes erodes the recovery break, which erodes the next sprint — small inaccuracies snowball into burnout. Live timers solve the drift problem cleanly.

Engineering and operations rely on it

Server log analysis, distributed tracing, SLA monitoring, and incident retrospectives all rest on consistent timestamps. A bug that reads as 5 ms in one timezone and 5,000 ms in another isn't the same bug — coherent time math is a load-bearing layer of every reliable system.

Tricky Cases This Calculator Gets Right

Shifts that cross midnight

Type 22:00 → 06:00 in the Work Hours module and the calculator detects the wrap, treats the end time as the next day, and computes 8 hours rather than negative 16. The detection runs automatically and shows a 'crosses midnight' badge so the interpretation is explicit.

DST transitions

Adding 24 hours across a spring-forward boundary produces a 23-hour wall-clock change; across fall-back the wall-clock advances 25 hours. The calculator's Date Math module honors the real-world clock shift and surfaces the resulting wall-clock time in your chosen timezone — UTC equivalents stay correct in both directions.

Adding a month to month-end

31 January + 1 month returns 28 February (or 29 in a leap year), not an invalid 31 February. The calculator clamps to the last day of the target month — the same rule Excel, Postgres, and Java's java.time.Period use.

Negative durations and inverted ranges

Subtracting a larger duration from a smaller one returns a signed negative result with an explicit minus sign in the headline; reversing the order in the Time Difference module returns the absolute magnitude and flags the direction so the meaning isn't accidentally misread.

Mixed-unit expressions

'2w + 3d − 7h' parses cleanly — weeks, days, and hours mix without losing precision because everything is converted to milliseconds before summing. The tokenised view in the result card shows each parsed term so you can verify what the calculator actually saw.

Very small and very large values

The Unit Converter switches automatically to scientific notation below 0.0001 and above 1×10¹⁵, so converting 5 nanoseconds to years still produces a readable answer (~1.58×10⁻¹⁶) instead of disappearing into floating-point underflow.

The Core Formulas

Every result behind this tool comes from one of a handful of closed-form rules. Here are the most useful.

Total seconds between two moments

(end_ms − start_ms) ÷ 1000

Subtract the millisecond gap and divide by 1000. Exact for any range.

Add a duration to a date

result_ms = start_ms + (d × 86400000 + h × 3600000 + m × 60000 + s × 1000)

Convert the duration to milliseconds and add. Year and month components apply calendrically before the millisecond shift.

Calendrical year/month/day breakdown

walk(start → end) in y, then mo, then d, then h, m, s

Pick the largest whole unit that fits, then recurse on the remainder. The same method spreadsheets use.

Unit conversion

result = value × ms_per_source ÷ ms_per_target

Every unit is defined as a millisecond constant. Year = 365.2425 × 86,400,000 ms. Month = 30.4368 × 86,400,000 ms.

Working hours (payroll)

payroll = regular_h + overtime_h × OT_multiplier

Where regular = min(worked, OT_threshold) and overtime = max(0, worked − OT_threshold). Worked = shift − break.

Live countdown

remaining_ms = target_ms − now_ms

Refreshed every second (or every 50 ms with millisecond precision on). Negative values flip the display into elapsed-time mode.

Common Time-Calculation Mistakes

Quoting calendar days when business days are expected

If a stakeholder hears 'two-week QA window,' most mentally translate to ten working days. If you meant 14 calendar days, the team has 10 — possibly fewer once a holiday or two land. State the unit explicitly, and prefer business-day mode for project commitments.

Forgetting daylight saving

Adding 24 hours and assuming the wall-clock stays identical breaks twice a year. For schedule-sensitive math (meeting invites, automation cron jobs, court filings), use the calculator's timezone-aware Date Math module — UTC values stay exact, local wall-clock values shift correctly.

Mixing 12-hour and 24-hour formats

Reading 6:00 as 06:00 vs 18:00 changes the answer by 12 hours. The clock-format toggle in this calculator updates every result display while keeping the underlying math identical — flip it once and stick with it across a session.

Approximating with 30-day months or 365-day years

Multiplying days by 30 to get months drifts noticeably over a year; dividing days by 365 to get years drifts by a quarter day per leap. For legally consequential math — vesting cliffs, statute deadlines, tax windows — use the calendrical year/month/day breakdown rather than the decimal approximation.

Counting break time as paid

Unpaid breaks are excluded from payroll hours but often included in the total time on site — and labour-law definitions vary by jurisdiction. The Work Hours module subtracts the break duration from worked hours; verify your local rules before quoting a payroll number.

Negative durations slipping through

If end is before start, a naive subtraction yields a negative number that's easy to miss in a chart or spreadsheet. The calculator's headline always shows the sign explicitly and the difference module flags inverted ranges so the meaning is never ambiguous.

UTC, Unix Time, and Military Format — A Quick Reference

UTC (Coordinated Universal Time) is the modern successor to GMT and the world's primary time reference. Every IANA timezone is defined as an offset from UTC, and the Unix timestamp measures the number of seconds since 00:00:00 UTC on 1 January 1970 — the Unix epoch. The Time Calculator stores every internal moment in UTC and renders it in your chosen timezone for display, so cross-zone math always stays correct.

Military time, also called the 24-hour clock, expresses every moment as four digits from 0000 (midnight) through 1200 (noon) to 2359 (one minute before midnight). It removes the AM/PM ambiguity of the 12-hour clock and is the format used by militaries, aviation, healthcare, transit, and most of the world outside the US. The clock-format toggle on this calculator switches every result display between 12-hour and 24-hour notation; the underlying math is unaffected.

ISO 8601 — the standard timestamp format used by JSON APIs, databases, and log files — combines a UTC date and time with an optional timezone designator: 2026-05-26T14:30:00Z. The Z stands for “Zulu time” (UTC). The Date Math module returns every result in ISO 8601 alongside the human-readable form, so the output drops cleanly into a calendar invite, a cron job, or a database INSERT.

Methodology & Trust

Every calculation runs entirely in your browser — no inputs leave your device, no analytics request carries your dates or shift times, and no server-side state is ever created. Calendar arithmetic uses the proleptic Gregorian calendar; total-millisecond computations come from JavaScript's native Date object backed by the Unix epoch; US federal holiday rules are sourced from the Office of Personnel Management's official observance schedule. Saved calculations live only in your browser's local storage and can be cleared with one tap.

For technical detail see our methodology page and editorial policy. For business-grade legal, tax, payroll, or compliance questions, always confirm the result with a qualified professional — the calculator is a tool, not advice.

Frequently Asked Questions

Open the Time Difference module, pick a start date (with optional time-of-day) and an end date, and the calculator returns the exact gap in years, months, weeks, days, hours, minutes, and seconds. The math is millisecond-based: each timestamp is converted to Unix milliseconds, subtracted, and broken into calendrical units by walking whole years and months forward. Optional business-day mode counts only Monday–Friday, and the holiday-exclusion toggle skips US federal holidays — useful for project schedules, contract notice periods, and SLA windows.

Open the Add & Subtract module, type the first duration into the Days / Hours / Minutes / Seconds row, pick Add, then type the second duration. The calculator auto-normalises the result — 75 minutes becomes 1h 15m, 25 hours becomes 1d 1h — and shows the total in seconds, minutes, hours, and days simultaneously. For more complex expressions like '1d 5h + 3h 20m − 45m', switch to the Time Expression Solver and type the whole expression at once.

Yes. Both the Add & Subtract module and the Date Math module support subtraction. In the duration calculator, picking Subtract returns the signed difference and flags a negative result so the magnitude is interpreted correctly. In the date-time calculator, subtraction works backwards from the chosen start date — e.g., 'today minus 90 days 3 hours' returns the precise prior moment, accurate to the second, with day-of-week, ISO 8601, and Unix-timestamp output.

Elapsed time is the duration between a fixed past moment and the present — the inverse of a countdown. Switch the Timer module to Elapsed mode, drop in a start moment, and the timer ticks upward in real time. Common uses include sobriety counters, project-launch milestones, relationship duration trackers, and stopwatch-style task timing. The display survives page refreshes through local storage and updates every second.

When you set a timezone in the Date Math module, the calculator stores the underlying UTC instant and applies your selected IANA zone (Europe/London, America/New_York, Asia/Tokyo, etc.) when displaying the result. Adding 24 hours in a DST-respecting zone may return a different wall-clock time on the other side of a transition — the calculator honors that. For comparing wall clocks across multiple zones, use the dedicated Time Zone Converter linked from the related-tools panel.

UTC (Coordinated Universal Time) is the world's primary time reference — the modern successor to GMT. Every IANA timezone is defined as an offset from UTC, and Unix timestamps measure the number of seconds since 00:00:00 UTC on 1 January 1970 (the Unix epoch). The Time Calculator stores every moment internally in UTC, then renders it in your chosen timezone for display. UTC has no daylight saving and never changes, which makes it the safe reference point for cross-zone scheduling, server logs, and financial trade timestamps.

Yes — the Work Hours module accepts a start shift, end shift, unpaid break duration, and an optional overtime threshold and night-shift window. The output separates regular hours, overtime hours, night-shift hours, and net payroll hours, and converts those into daily and weekly totals based on your workdays-per-week input. Overnight shifts that cross midnight are handled automatically. The hourly-rate field returns an estimated daily and weekly pay.

Open the Time Unit Converter module, type any value, pick the source unit (from years down to nanoseconds), and the calculator shows the same duration in every other unit instantly. Very small or very large numbers automatically switch to scientific notation. Years use the Gregorian average (365.2425 days) and months use the same calendar average (30.4368 days) — exact, not lossy approximations.

Military time, also called the 24-hour clock, expresses every moment as four digits from 0000 to 2359 — 1:00 PM is 1300, 5:30 PM is 1730, midnight is 0000. It removes the 12-hour AM/PM ambiguity and is the format used by NATO militaries, aviation, healthcare, transit, and most of the world outside the US. The Time Calculator's clock-format toggle switches every result display between 12-hour and 24-hour notation; the underlying math is unaffected.

Yes. In the Date Math module, pick a start date and time (or tap Use Current Time), choose Add, then enter the duration in years, months, days, hours, minutes, and seconds. The result returns the final wall-clock moment, day of week, full ISO 8601 string, and Unix timestamp, and gracefully respects DST transitions in the selected timezone. Pick Subtract to project backward in time. Common uses include contract renewal dates, shipping ETAs, expiry timers, vesting schedules, and exam deadlines.