ForHosting KIT · Dates & time

Add hours to a datetime

Shift a date and time by a number of hours and read the result in UTC: 10:00 UTC on 1 March 2024 plus 5 hours is 15:00 UTC the same day. Negative and fractional hours work too. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Datetime
2024-03-01T10:00:00Z
Hours
5
You get
Result
2024-03-01T15:00:00Z
Year
2,024
Month
3
Day
1

Shifting a timestamp by a fixed number of hours is a daily chore in APIs, job schedulers, SLA clocks, and spreadsheet imports, yet host time zones and daylight-saving rules turn a seemingly trivial addition into a source of flaky tests. This tool accepts an explicit ISO-8601 datetime—full clock time with Z or a numeric offset, or a date-only string treated as midnight UTC—plus a finite hour offset that may be positive, negative, fractional, or zero. It converts the base to UTC epoch seconds with pure Gregorian calendar math, adds round(hours times 3600) whole seconds, and reconstructs a normalized UTC result as year-month-day T hour-minute-second Z. Impossible calendar days and malformed strings fail with a clear validation error instead of wrapping into the next month.

How UTC hour addition works without a system clock

Begin with an explicit base datetime written in the international ISO form so every client agrees on the same year, month, day, and optional clock fields. When only a calendar date is supplied, treat it as midnight Coordinated Universal Time. When a time is present, accept optional fractional seconds (truncated to whole seconds) and either a trailing Z for UTC or a numeric plus-or-minus hour-minute offset that is subtracted when converting to absolute time.

Validate that the civil day exists under Gregorian leap rules—February twenty-nine is legal only when the year is divisible by four except that century years must also be divisible by four hundred—and that hour, minute, and second lie in their usual ranges. Convert the civil triple to a day serial with the Howard Hinnant days-from-civil algorithm, multiply by eighty-four thousand six hundred seconds, add the local time-of-day, and subtract offset minutes times sixty to obtain UTC epoch seconds. Add the hour offset converted as round(hours times 3600).

Reconstruct the civil date with civil-from-days, peel hour, minute, and second from the residual second-of-day, and format a four-two-two T two-two-two Z string.

Where add-hours-to-a-datetime calculators show up in real work

Operations teams convert support ticket created times into first-response deadlines by adding contractual hour windows without inventing a full calendar library. Data engineers materialize delayed-event columns for pipelines that fire N hours after an ingestion timestamp stored as ISO text. Product managers prototype trial windows, cache TTL previews, and session-expiry copy using the same numbers their backend will ship.

If you later need calendar day addition without a clock, business-day schedules that skip weekends, countdown breakdowns between two instants, or pure time-unit conversion between hours and minutes, treat those as separate search intents and landings rather than overloading this add-hours-to-a-datetime page—those problems solve different queries even when some arithmetic looks similar under the hood.

SLA and response deadlines

Add contractual response windows (for example four, eight, or twenty-four hours) to an explicit ticket ISO timestamp and store a stable UTC deadline.

Pipeline delay columns

Materialize delayed-event times as base ISO datetime plus a configured hour offset for ETL jobs, caches, and scheduled retries.

What does add hours to a datetime mean?

It means taking an explicit ISO-8601 timestamp, converting it to UTC from the string alone, moving forward or backward by a finite number of hours, and returning the shifted UTC datetime.

Does it use my computer’s local timezone?

No. All math is UTC derived only from the input string. Numeric offsets in the input are applied once when converting to absolute time; the result is always emitted with a trailing Z.

Can I use fractional hours?

Yes. Values such as 1.5 become round(1.5 × 3600) = 5400 whole seconds. Non-finite values and absurd magnitudes are rejected.

What datetime formats are accepted?

Date-only YYYY-MM-DD (midnight UTC), or full datetime with optional seconds and fraction, ending in Z or a numeric ±HH:mm offset. Loose forms without fixed digit widths are rejected.

What does it cost?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/date/add-hours

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/date/add-hours \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"datetime":"2024-03-01T10:00:00Z","hours":5}'
{
  "datetime": "2024-03-01T10:00:00Z",
  "hours": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "date.add_hours",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

What you send and what you get back

Send two required fields: datetime as an ISO-8601 string such as two thousand twenty-four hyphen zero three hyphen zero one T ten colon zero zero colon zero zero Z, and hours as a finite number such as five, zero, negative three, or one point five. Classic checks include adding five hours to ten o'clock UTC to reach fifteen o'clock the same day, adding twenty-four hours to cross a calendar day, subtracting three hours from a morning timestamp, converting a plus-zero-two offset input into a pure Z result after the math, and rejecting a base such as the twenty-ninth of February in a common year. Aliases date, dt, timestamp, and ts are accepted for the base string. Missing fields, non-string datetimes, strings that do not match ISO shape, non-finite hour offsets, impossible calendar days, and out-of-range result years all fail with invalid_input and are not charged. On success the response echoes the trimmed base datetime, the hours offset that was applied, the result UTC ISO string after addition, the numeric year, month, day, hour, minute, and second of the result, the result epoch_seconds, the integer delta_seconds that were added, hours_added, and a short formula string documenting the UTC reconstruction. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where add-hours-to-a-datetime calculators show up in real work

Because the capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

QA fixtures around midnight

Generate deterministic expected timestamps that cross day and leap boundaries for regression tests without depending on the host clock.

Read the full KIT documentation →