calendar math · setFullYear · setMonth · live

Add or subtract from a date

Calendar-aware arithmetic: adding a month from Jan 31 lands on Feb 28/29, not Mar 3. Years, months, days, hours, minutes all stack.

Quick Start

How calendar math works

We use JavaScript's setFullYear / setMonth / setDate, which respect month lengths and leap years. Adding 1 month to Jan 31 produces Feb 28 (or 29 in a leap year), not Mar 3.

  1. 01

    Pick a start date

    Date picker uses local midnight.

    Parsing accepts ISO 8601, RFC 3339, RFC 2822, and Unix epoch seconds/milliseconds. The Date constructor handles the rest with browser-engine consistency.

    inputISO 8601RFC 3339epochlive
    start · timestampdate · ISO
    2026-05-21
    loaded · ISO 8601zone · ready
  2. 02

    Choose add or subtract

    Sign applies to every field — handy for "60 days ago" style queries.

    All math runs in UTC internally to avoid DST landmines; presentation converts back to the user’s zone via Intl.DateTimeFormat.

    opUTC mathIntlDST-safelive
    op · options+ / - · live
    op = +
    options applied · UTCDST-safe
  3. 03

    Set the delta

    Years, months, days, hours, minutes — combine as needed.

    Output respects the chosen timezone offset (Z vs +05:30) and pads digits per ISO conventions so sorts stay chronological.

    deltaoffsetzone-awaresortablepadded
    Δ · computedy/m/d/h/m · ready
    +1y +2m
    computed · instantsortable
  4. 04

    Read the result

    ISO, local, and day-of-week shown side by side. Click the big value to copy.

    Copy writes via the Async Clipboard API; nothing pings a time server — the browser’s clock is the only oracle.

    outclipboardno oracledeterministicclient-side
    ✓ · copiedready · done
    ✓ Copied
    shipped · ready to shipsuccess
Pro tips

Time math without DST landmines

Always store UTC

Convert to local for display only. UTC storage avoids DST jumps and timezone drift in databases.

Watch leap seconds

POSIX time doesn’t count leap seconds; some systems do. Don’t use timestamps for sub-second precision across boundaries.

Prefer Temporal eventually

The Date API has many quirks. Temporal is shipping in modern engines and handles zones correctly.

Cron is timezone-tricky

Cron expressions run in the daemon’s local zone unless told otherwise. Pin a TZ explicitly for predictable runs.

ISO 8601 sorts naturally

YYYY-MM-DDTHH:mm:ss sorts correctly as a string. Don’t use US-style MM/DD/YYYY for anything machine-readable.

Beware Y2K38

Signed 32-bit Unix timestamps overflow in 2038. Use 64-bit storage end-to-end for long-lived systems.

Use Cases

When to do calendar math

Deadlines, expirations, scheduling.

Subscription expiry

Today + 1 year to set a renewal date. Math runs in UTC under the hood to dodge DST jumps — local time is only for display. That means scheduling logic and date diffs survive March / November fall-back without the classic off-by-one-hour bug.

DST-safe

Project deadlines

Start date + sprint count × 2 weeks = launch. Browser clock is the only source — no external time server, no privacy leak, no rate limit. Pair with NTP-synced server time for high-accuracy use cases, but for human-scale work the browser clock is plenty.

UTC-correct

Document retention

Apply a 7-year rule to today's date. ISO 8601 output sorts naturally as strings, perfect for filenames (report-2026-01-15.pdf) and log lines that need chronological ordering without parsing. Drop into S3 keys for free time-bucketing.

ISO-sortable

Trial periods

Compute trial-ends-on dates for billing. Pairs cleanly with cron, scheduled tasks, and timestamped log analysis. The tool's output drops directly into APScheduler, Linux cron, or GitHub Actions schedule expressions without re-formatting.

spec-grade

Reminders

Schedule a reminder 30 days before a date. Output respects the chosen timezone offset (Z vs +05:30) so REST APIs and database TIMESTAMP WITH TIME ZONE columns round-trip cleanly. No ambiguity between "noon UTC" and "noon local".

zone-aware

Historical math

1066 + 1000 years = ? Useful for trivia & quizzes. Confirms the difference between epoch seconds (10 digits) and milliseconds (13 digits) before you commit code that mis-multiplies by 1000 — a classic bug in cross-language time handling.

epoch-accurate
FAQ

Frequently asked questions

We use calendar months. Adding a month to Jan 31 gives Feb 28/29, not Mar 3. Use Duration tool for 30-day average math.
Years, then months, then days, then hours, then minutes. Order matters: +1 month +30 days ≠ +30 days +1 month.
Use the minus operator. All fields apply the same sign for clarity.
Adding hours respects DST — adding 24h on a spring-forward day actually moves you 25 wall-clock hours.
No — the math runs locally in your browser tab.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!