Request a demo

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

FunctionWhat it does
CURRENT_TIMESTAMPCURRENT_TIMESTAMP() returns the current instant as a TIMESTAMP with microsecond precision, shown in UTC.
FORMAT_TIMESTAMPFORMAT_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_TIMESTAMPPARSE_TIMESTAMP(format_string, string[, time_zone]) converts a STRING to a TIMESTAMP using % elements.
TIMESTAMPTIMESTAMP 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_ADDTIMESTAMP_ADD(ts, INTERVAL n part) adds an exact duration to a TIMESTAMP, in MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR or DAY (24 hours).
TIMESTAMP_DIFFTIMESTAMP_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_MILLISTIMESTAMP_MILLIS(n) converts milliseconds since 1970-01-01 00:00:00 UTC to a TIMESTAMP.
TIMESTAMP_SECONDSTIMESTAMP_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_SUBTIMESTAMP_SUB(ts, INTERVAL n part) subtracts an exact duration (MICROSECOND up to DAY) from a TIMESTAMP.
TIMESTAMP_TRUNCTIMESTAMP_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_MILLISUNIX_MILLIS(ts) returns the number of milliseconds since 1970-01-01 00:00:00 UTC as INT64, truncating microseconds.
UNIX_SECONDSUNIX_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

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.