induwara.lk
induwara.lkDate · Time

Countdown Timer — Days, Hours & Minutes Until Any Date

Pick any future date and watch a live countdown tick down to the second. Add an event title, then copy a sharable link that opens the same countdown on any device. Runs in your browser, no signup, no ads.

By Induwara AshinsanaUpdated May 11, 2026
Live countdown
Cross-checked · 2 algorithms

Friday, January 1, 2027 at 12:00 AM

Shown above the timer and on the shared link. Up to 80 characters.

Quick presets
Time remaining
0
years
5
months
28
days
12
hours
01
min
16
secs

15,681,676 seconds total · ISO 8601: P5M28DT12H1M16S

Total remaining

Days
181
Hours
4,356
Minutes
261,361
Seconds
15,681,676
Share this countdown

Copies a link that re-opens this exact target and title for anyone who clicks it.

Live total seconds matches an independent algorithm; calendar parts verified by round-trip addition. All arithmetic runs in your browser — the target date and title never leave your device.

How it works

The timer answers two questions at once: how long until the target, and how that gap reads as a calendar duration like "7 months, 20 days, 12 hours". Both use the half-open interval [now, target), so the moment the clock reaches the target the countdown switches to elapsed mode and starts counting up.

For the total counts (days, hours, minutes, seconds), the algorithm subtracts the two timestamps and divides the millisecond delta by the appropriate constant. This is the raw wall-clock difference and honestly reports DST shifts when they happen — a day that contains a DST transition counts as 23 or 25 hours instead of being silently normalised to 24.

For the calendar-aware Y/M/D + H/M/S breakdown, the algorithm follows the date-fns intervalToDuration anniversary rule. Given a start S and target T:

  1. Compute raw month gap M = (T.year − S.year) × 12 + (T.month − S.month).
  2. If the target's day-of-month hasn't reached the start day yet (T.day < S.day), or the days match but the time-of-day hasn't caught up, subtract one from M.
  3. Split into years and months: years = ⌊M / 12⌋, months = M mod 12.
  4. Build an anchor date S + M months, clamping the day-of-month to the last day of the resulting month so 31 Jan + 1 month becomes 28 Feb in a non-leap year, not 3 Mar.
  5. Compute the residual milliseconds from the anchor to T and split greedily into days, hours, minutes, and seconds. The breakdown reconciles exactly: S + Y years + M months + D days + H:Mn:S = T.

To guard against single-algorithm bugs, the total-seconds figure is cross-checked against a second implementation that uses raw millisecond division, and the calendar breakdown is verified by reconstructing the target through addition. Both checks must pass before the "cross-checked · 2 algorithms" badge appears in the live header.

Share links encode the target as an ISO 8601 UTC timestamp and the title via RFC 3986 percent-encoding, so a link copied from Colombo opens with the same instant in mind from Toronto — the browser then renders it in the visitor's local time zone for the countdown.

Worked examples

11 May 2026 12:00 → 11 May 2026 18:00 (six hours later)

  1. totalMonths = 0 × 12 + 0 = 0; same day, target time > start time → keep 0
  2. Anchor = 2026-05-11 12:00:00; remainder = 6 × 3,600,000 = 21,600,000 ms
  3. Greedy split: 0 days, 6 hours, 0 minutes, 0 seconds
  4. Breakdown = 0y 0m 0d 6h 0m 0s
  5. Total = 21,600 seconds — matches alternate ms-division algorithm ✓

11 May 2026 12:00 → 1 Jan 2027 00:00 (New Year)

  1. totalMonths = (2027 − 2026) × 12 + (0 − 4) = 8
  2. target.day (1) < start.day (11) → totalMonths = 7
  3. Years = 0, months = 7; anchor = clamp(2026-05-11 12:00 + 7 months) = 2026-12-11 12:00
  4. Remainder from 2026-12-11 12:00 to 2027-01-01 00:00 = 20 days + 12 hours
  5. Breakdown = 0y 7m 20d 12h 0m 0s
  6. Reconcile: 2026-05-11 12:00 + 7 months = 2026-12-11 12:00; + 20 days = 2026-12-31 12:00; + 12 hours = 2027-01-01 00:00 ✓

28 Feb 2025 → 29 Feb 2028 (leap-day target)

  1. totalMonths = 3 × 12 + 0 = 36
  2. target.day (29) > start.day (28) → keep 36
  3. Years = 3, months = 0; anchor = clamp(2025-02-28 + 36 months) = 2028-02-28 (Feb 2028 has 29 days, but the day-of-month is preserved at 28)
  4. Remainder = 1 day
  5. Breakdown = 3y 0m 1d 0h 0m 0s
  6. Verify by addition: 2025-02-28 + 3 years = 2028-02-28; + 1 day = 2028-02-29 ✓

Frequently asked questions

Sources & references

Algorithm and worked examples last cross-checked on 2026-05-11. The calendar arithmetic is stable, so this page is reviewed annually rather than on a fixed schedule.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.