BigQuery reference
BigQuery datetime functions
DATETIME is a civil date and time with no time zone: what a wall clock shows. Use it for local business times; use TIMESTAMP when you need an absolute point in time.
Functions in this category
| Function | What it does |
|---|---|
| CURRENT_DATETIME | CURRENT_DATETIME() returns the current date and time as a DATETIME, the wall-clock time in UTC or in the time zone you pass: CURRENT_DATETIME('Europe/Berlin'). |
| DATETIME | DATETIME builds a DATETIME from numbers, from a DATE and TIME, or converts a TIMESTAMP to local wall-clock time: DATETIME(ts, 'Europe/Berlin'). |
| DATETIME_ADD | DATETIME_ADD(datetime, INTERVAL n part) adds microseconds up to years to a DATETIME and returns a DATETIME. |
| DATETIME_DIFF | DATETIME_DIFF(end, start, part) returns the number of part boundaries between two DATETIME values as INT64. |
| DATETIME_SUB | DATETIME_SUB(datetime, INTERVAL n part) subtracts microseconds up to years from a DATETIME and returns a DATETIME. |
| DATETIME_TRUNC | DATETIME_TRUNC(datetime, part) rounds a DATETIME down to the start of a period, such as the hour, day, week or month. |
| FORMAT_DATETIME | FORMAT_DATETIME(format_string, datetime) turns a DATETIME into a STRING using % elements, for example FORMAT_DATETIME('%d/%m/%Y %H:%M', dt) gives 23/11/2026 18:45. |
| PARSE_DATETIME | PARSE_DATETIME(format_string, string) converts a STRING to a DATETIME using % elements, such as PARSE_DATETIME('%d/%m/%Y %H:%M', '23/11/2026 18:45'). |
More of the BigQuery reference
Date functionsTimestamp functionsString functionsAggregate functionsWindow functionsArray functionsJSON functionsConversion functionsConditional expressionsMathematical functionsHash and utility functionsQuery syntaxDDL statementsDML statementsScripting and data movementINFORMATION_SCHEMAError messagesBigQuery pricingPricing calculator
