TimestampUnix

timestamp arithmetic

Timestamp Calculator

Add or subtract time from any Unix timestamp — quick chips for the common operations, or a custom value and unit. Hours, minutes and seconds shift the instant exactly; days and weeks are calendar-aware in the selected timezone so DST never moves your wall clock.

Quick operations

Day/week operations respect DST in the selected timezone.

Result

  • Result timestamp (seconds)

    —

  • Result timestamp (milliseconds)

    —

  • UTC

    —

  • Selected timezone

    —

  • ISO 8601

    —

  • Relative to base

    —

Timestamp ranges: start and end of day, week, month, year

Need the boundaries for a SQL WHERE clause, an analytics window or a log query? Pick a period, a date and a timezone — the generator returns exact second-precision start and end timestamps, plus their UTC renderings.

Timestamp math in code

// JavaScript — add 7 days (exact 24h days)
const next = ts + 7 * 86400;

// Python — calendar-aware, DST-safe
from datetime import timedelta, timezone
from zoneinfo import ZoneInfo
dt = datetime.fromtimestamp(ts, ZoneInfo('America/New_York'))
next_week = (dt + timedelta(days=7)).timestamp()

// PostgreSQL — range for "this month"
SELECT
  extract(epoch from date_trunc('month', now()))::bigint AS month_start,
  extract(epoch from date_trunc('month', now()) + interval '1 month')::bigint AS next_month_start;

The Python example shows why calendar-aware math matters: adding a timedeltato a zoned datetime respects local time across DST changes, while raw+ 604800 seconds does not.

Frequently asked questions

How do I add days to a Unix timestamp?
For pure 24-hour days, add days × 86400. But if you mean "the same wall-clock time on another calendar day", adding 86,400 seconds can be wrong across a DST change — a day may be 23 or 25 hours long. This calculator does calendar-aware day math in your selected timezone, so adding 7 days across a DST boundary lands on the same local time.
How do I get the timestamp for the start or end of a day?
Use the range generator below. Start of day is 00:00:00.000 in the chosen zone; end is the last second of the day (23:59:59 in most tools, or …59.999999999 at full precision). Always pick the timezone — "midnight" is a different instant in every zone.
Why do my SQL queries miss the last day of the range?
A common off-by-one: BETWEEN start AND end is inclusive, but if your end is next-day midnight, use >= start AND < next_day_start instead. Half-open ranges ([start, end)) compose cleanly and never double-count boundary rows. The range generator gives you the exact second-precision boundaries for both styles.
What timestamp units do the calculations use?
Internally everything is canonical nanosecond BigInt arithmetic, so adding a second to a nanosecond-precision timestamp never rounds. Results are shown in seconds and milliseconds; the base accepts any of the four units or a date string.

Related tools