BigQuery · Timestamp function
BigQuery TIMESTAMP_ADD
TIMESTAMP_ADD(ts, INTERVAL n part) adds an exact duration to a TIMESTAMP, in MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR or DAY (24 hours). It doesn't accept WEEK, MONTH or YEAR; use DATETIME_ADD for calendar steps.
TIMESTAMP_ADD moves an instant forward by a fixed amount of time, independent of any time zone. DAY always means 24 hours and HOUR 60 minutes. The amount can be negative or come from a column, such as TIMESTAMP_ADD(issued_at, INTERVAL ttl_seconds SECOND).
Because the step is a duration, a day added across a daylight saving change lands at a different local clock time: 12:00 in New York on October 31, 2026 plus one day is 11:00 local on November 1. When you mean "the same local time tomorrow", convert to DATETIME in that zone, use DATETIME_ADD and convert back.
Calendar units are rejected: INTERVAL 1 MONTH fails with "TIMESTAMP_ADD does not support the MONTH date part when the argument is TIMESTAMP type", and WEEK, QUARTER and YEAR fail the same way. Use INTERVAL 7 DAY for weeks; for months and years, go through DATETIME.
Syntax
TIMESTAMP_ADD(timestamp_expression, INTERVAL step_size step_unit)Arguments and return value
| Argument | Description |
|---|---|
timestamp_expression | The TIMESTAMP to shift. |
step_size | An INT64 amount; negative values move backwards. |
step_unit | MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR or DAY (24 hours). |
Returns: TIMESTAMP
Examples
Add minutes, hours and days
SELECT
TIMESTAMP_ADD(TIMESTAMP '2026-11-23 18:45:00+00', INTERVAL 90 MINUTE) AS plus_90_min,
TIMESTAMP_ADD(TIMESTAMP '2026-11-23 18:45:00+00', INTERVAL 36 HOUR) AS plus_36_hours,
TIMESTAMP_ADD(TIMESTAMP '2026-11-23 18:45:00+00', INTERVAL 7 DAY) AS plus_week;| plus_90_min | plus_36_hours | plus_week |
|---|---|---|
| 2026-11-23 20:15:00 UTC | 2026-11-25 06:45:00 UTC | 2026-11-30 18:45:00 UTC |
Token expiry from a TTL column
WITH tokens AS (
SELECT 't1' AS token_id, TIMESTAMP '2026-11-23 10:00:00+00' AS issued_at, 3600 AS ttl_seconds UNION ALL
SELECT 't2', TIMESTAMP '2026-11-23 23:30:00+00', 86400
)
SELECT token_id, TIMESTAMP_ADD(issued_at, INTERVAL ttl_seconds SECOND) AS expires_at
FROM tokens
ORDER BY token_id;| token_id | expires_at |
|---|---|
| t1 | 2026-11-23 11:00:00 UTC |
| t2 | 2026-11-24 23:30:00 UTC |
One DAY is 24 hours, even across DST
New York falls back from EDT to EST on November 1, 2026, so 24 hours after noon is 11:00 local time.
SELECT
TIMESTAMP_ADD(TIMESTAMP '2026-10-31 12:00:00 America/New_York', INTERVAL 1 DAY) AS plus_1_day,
DATETIME(TIMESTAMP_ADD(TIMESTAMP '2026-10-31 12:00:00 America/New_York', INTERVAL 1 DAY), 'America/New_York') AS local_clock;| plus_1_day | local_clock |
|---|---|
| 2026-11-01 16:00:00 UTC | 2026-11-01T11:00:00 |
Add a month: go through DATETIME
Both conversions use UTC here. Pass the same zone to DATETIME() and TIMESTAMP() if months should follow local time.
SELECT
TIMESTAMP(DATETIME_ADD(DATETIME(TIMESTAMP '2026-01-31 09:00:00+00'), INTERVAL 1 MONTH)) AS one_month_later;| one_month_later |
|---|
| 2026-02-28 09:00:00 UTC |
Common mistakes
- Using MONTH, QUARTER, YEAR or WEEK. They fail on TIMESTAMP; use
INTERVAL 7 DAYfor weeks and DATETIME_ADD for calendar units.ts + INTERVAL 1 MONTHfails too. - Expecting DAY to respect local midnight. TIMESTAMP_ADD adds 24 hours; around DST changes the local clock time shifts by an hour.
- Porting
DATEADD(hour, 1, ts)(Snowflake, SQL Server) orts + INTERVAL '1 hour'(PostgreSQL). UseTIMESTAMP_ADD(ts, INTERVAL 1 HOUR)orts + INTERVAL 1 HOUR. - Overflowing the range. Results beyond 9999-12-31 23:59:59.999999 UTC are an error, which matters when an expiry column uses a sentinel far in the future.
Cost and performance
- TIMESTAMP_ADD, TIMESTAMP_SUB, TIMESTAMP_DIFF and TIMESTAMP_TRUNC are on BigQuery's list of functions that can wrap a partitioning column and still allow partition pruning when their other arguments are constants. Arithmetic with operators (
ts + INTERVAL 1 DAY > ...) is not; move the arithmetic to the constant side:ts > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY).
FAQ
How do I add hours to a timestamp in BigQuery?
TIMESTAMP_ADD(ts, INTERVAL 2 HOUR) or ts + INTERVAL 2 HOUR.
Why does TIMESTAMP_ADD not support MONTH?
A month has no fixed length, and an instant has no calendar until you pick a zone. Convert to DATETIME in a zone, use DATETIME_ADD with MONTH, then convert back with TIMESTAMP(dt, zone).
What is the difference between TIMESTAMP_ADD and DATETIME_ADD?
TIMESTAMP_ADD adds an exact duration to an instant. DATETIME_ADD changes a wall-clock reading and supports months and years.
Related
Errors you may hit
More timestamp functions
All BigQuery timestamp functions · All functions · BigQuery error messages
