BigQuery reference
BigQuery timestamp functions
TIMESTAMP is an absolute point in time with microsecond precision, stored in UTC. These functions add, subtract, truncate, format and convert timestamps, and most take an optional time zone.
Functions in this category
| Function | What it does |
|---|---|
| CURRENT_TIMESTAMP | CURRENT_TIMESTAMP() returns the current instant as a TIMESTAMP with microsecond precision, shown in UTC. |
| FORMAT_TIMESTAMP | FORMAT_TIMESTAMP(format_string, ts[, time_zone]) converts a TIMESTAMP to a STRING with % elements, in UTC or in the zone you pass: FORMAT_TIMESTAMP('%F %H:%M', ts, 'Europe/Berlin'). |
| PARSE_TIMESTAMP | PARSE_TIMESTAMP(format_string, string[, time_zone]) converts a STRING to a TIMESTAMP using % elements. |
| TIMESTAMP | TIMESTAMP converts a STRING, DATE or DATETIME to a TIMESTAMP, reading it in UTC or in the time zone you pass: TIMESTAMP('2026-11-23 09:00:00', 'Europe/Berlin') is 08:00 UTC. |
| 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). |
| TIMESTAMP_DIFF | TIMESTAMP_DIFF(end_ts, start_ts, part) returns the number of whole MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR or DAY units between two TIMESTAMPs as INT64, truncated toward zero. |
| TIMESTAMP_MILLIS | TIMESTAMP_MILLIS(n) converts milliseconds since 1970-01-01 00:00:00 UTC to a TIMESTAMP. |
| TIMESTAMP_SECONDS | TIMESTAMP_SECONDS(n) converts Unix epoch seconds (seconds since 1970-01-01 00:00:00 UTC) to a TIMESTAMP: TIMESTAMP_SECONDS(1795392000) is 2026-11-23 00:00:00 UTC. |
| TIMESTAMP_SUB | TIMESTAMP_SUB(ts, INTERVAL n part) subtracts an exact duration (MICROSECOND up to DAY) from a TIMESTAMP. |
| TIMESTAMP_TRUNC | TIMESTAMP_TRUNC(ts, part[, time_zone]) rounds a TIMESTAMP down to the start of a minute, hour, day, week, month or year, in UTC or in the zone you pass. |
| UNIX_MILLIS | UNIX_MILLIS(ts) returns the number of milliseconds since 1970-01-01 00:00:00 UTC as INT64, truncating microseconds. |
| UNIX_SECONDS | UNIX_SECONDS(ts) returns the number of seconds since 1970-01-01 00:00:00 UTC as INT64, dropping fractions of a second. |
More of the BigQuery reference
Date functionsDatetime functionsString functionsAggregate functionsWindow functionsArray functionsJSON functionsConversion functionsConditional expressionsMathematical functionsHash and utility functionsQuery syntaxDDL statementsDML statementsScripting and data movementINFORMATION_SCHEMAError messagesBigQuery pricingPricing calculator
