BigQuery · Date function
BigQuery DATE
DATE builds a DATE from year, month and day numbers, or converts a TIMESTAMP or DATETIME to its calendar date. DATE(ts, 'America/New_York') returns the local date of a timestamp; without a time zone it uses UTC.
DATE has three jobs. DATE(2026, 11, 23) builds a date from integers. DATE(datetime_value) drops the time from a DATETIME. DATE(timestamp_value[, time_zone]) returns the calendar date of a TIMESTAMP in a time zone, UTC by default.
The time zone matters more than it looks. An order placed at 22:30 in New York on November 22 is stored as a TIMESTAMP of 03:30 UTC on November 23, so DATE(created_at) puts it on the 23rd. Grouping daily revenue by DATE(created_at, 'America/New_York') puts it on the day the customer saw. EXTRACT(DATE FROM ts AT TIME ZONE 'America/New_York') gives the same result.
To turn a STRING into a DATE, use CAST('2026-11-23' AS DATE) for the canonical YYYY-MM-DD layout or PARSE_DATE for any other layout. DATE(2026, 2, 30) fails with "Input calculates to invalid date"; SAFE.DATE(2026, 2, 30) returns NULL instead.
Syntax
DATE(year, month, day)
DATE(timestamp_expression[, time_zone_expression])
DATE(datetime_expression)Arguments and return value
| Argument | Description |
|---|---|
year, month, day | INT64 values for the calendar date to build. |
timestamp_expression | A TIMESTAMP whose calendar date you want. |
time_zone_expression | Optional STRING time zone for the TIMESTAMP form, such as 'Europe/Berlin' or '+05:30'. Defaults to UTC. |
datetime_expression | A DATETIME; the time part is dropped. |
Returns: DATE
Examples
Build a date, or take the date part
SELECT
DATE(2026, 11, 23) AS from_parts,
DATE(DATETIME '2026-11-23 18:45:00') AS from_datetime,
DATE(TIMESTAMP '2026-11-23 18:45:00+00') AS from_timestamp;| from_parts | from_datetime | from_timestamp |
|---|---|---|
| 2026-11-23 | 2026-11-23 | 2026-11-23 |
Convert a timestamp to a date in a time zone
03:30 UTC is 22:30 on November 22 in New York and 12:30 on November 23 in Tokyo.
SELECT
DATE(TIMESTAMP '2026-11-23 03:30:00+00') AS utc_date,
DATE(TIMESTAMP '2026-11-23 03:30:00+00', 'America/New_York') AS new_york_date,
DATE(TIMESTAMP '2026-11-23 03:30:00+00', 'Asia/Tokyo') AS tokyo_date;| utc_date | new_york_date | tokyo_date |
|---|---|---|
| 2026-11-23 | 2026-11-22 | 2026-11-23 |
Daily orders by the customer's local day
Grouped by DATE(created_at) in UTC, the same rows would give 1 order on the 22nd and 2 on the 23rd.
WITH orders AS (
SELECT 1 AS order_id, TIMESTAMP '2026-11-22 23:10:00+00' AS created_at UNION ALL
SELECT 2, TIMESTAMP '2026-11-23 02:45:00+00' UNION ALL
SELECT 3, TIMESTAMP '2026-11-23 14:00:00+00'
)
SELECT
DATE(created_at, 'America/New_York') AS local_day,
COUNT(*) AS orders
FROM orders
GROUP BY local_day
ORDER BY local_day;| local_day | orders |
|---|---|
| 2026-11-22 | 2 |
| 2026-11-23 | 1 |
Invalid parts: error or NULL
Without the SAFE. prefix the query fails with "Input calculates to invalid date: 2026-02-30".
SELECT SAFE.DATE(2026, 2, 30) AS feb_30;| feb_30 |
|---|
| NULL |
Common mistakes
- Taking the date of a TIMESTAMP without a time zone.
DATE(ts)is the UTC date. For business reporting, pass the zone your business runs in:DATE(ts, 'Europe/Paris'). - Passing a time zone with a DATETIME.
DATE(datetime_value, 'UTC')has no matching signature: a DATETIME has no zone to convert from. Convert first withTIMESTAMP(datetime_value, 'Europe/Paris')if the value is local time. - Expecting DATE to parse any string. Use
CAST(s AS DATE)forYYYY-MM-DDand PARSE_DATE for layouts such as23/11/2026; a bad value fails the query unless you use SAFE_CAST orSAFE.PARSE_DATE. - Porting
TO_DATE(s, 'YYYY-MM-DD')from Snowflake, Oracle or PostgreSQL. BigQuery has no TO_DATE; usePARSE_DATE('%Y-%m-%d', s).
Cost and performance
- Filtering a TIMESTAMP-partitioned table with
DATE(ts) = '2026-11-23'orCAST(ts AS DATE) = '2026-11-23'still prunes partitions, according to BigQuery's partition pruning guide. A time zone argument changes which partitions match, so test it with a dry run.
FAQ
How do I convert a timestamp to a date in BigQuery?
Use DATE(ts) for the UTC date or DATE(ts, 'America/Chicago') for the local date. CAST(ts AS DATE) and EXTRACT(DATE FROM ts) also return the UTC date.
How do I convert a string to a date?
CAST('2026-11-23' AS DATE) works for the YYYY-MM-DD layout. For any other layout use PARSE_DATE, for example PARSE_DATE('%d/%m/%Y', '23/11/2026').
How do I make a date from year, month and day columns?
Use DATE(year_col, month_col, day_col). All three must be INT64; wrap the call in SAFE.DATE(...) if some combinations may be invalid, such as February 30.
Related
Errors you may hit
More date functions
All BigQuery date functions · All functions · BigQuery error messages
