Request a demo

BigQuery · Date function

BigQuery DATE_TRUNC

DATE_TRUNC rounds a date down to the start of a period: DATE_TRUNC(order_date, MONTH) returns the first day of that month. It also truncates DATETIME and TIMESTAMP values. Use it to group rows by week, month, quarter or year.

GoogleSQL for BigQuery · Checked against the official reference in November 2026

DATE_TRUNC takes a date and a date part and returns the start of the period that contains the value. For a DATE the result is still a DATE, so you can group by it, join on it and compare it with other dates, unlike EXTRACT, which returns a bare number.

The date part is written without quotes, and it comes second: DATE_TRUNC(order_date, MONTH). PostgreSQL, Snowflake and Redshift take the part first, as a string (DATE_TRUNC('month', order_date)); BigQuery rejects that with "A valid date part name is required but found order_date" until you swap the arguments. A STRING column instead of a DATE fails with No matching signature; convert it with CAST or PARSE_DATE first.

Weeks start on Sunday by default. Use WEEK(MONDAY) or ISOWEEK for Monday-based weeks. DATE_TRUNC also accepts a DATETIME or a TIMESTAMP and returns the same type, with time parts such as HOUR allowed; for a TIMESTAMP you can pass a time zone, so DATE_TRUNC(ts, DAY, 'America/New_York') returns New York midnight. DATETIME_TRUNC and TIMESTAMP_TRUNC do the same for those types.

Syntax

DATE_TRUNC(date_value, date_part)

DATE_TRUNC(datetime_value, datetime_part)

DATE_TRUNC(timestamp_value, timestamp_part[, time_zone])

Arguments and return value

ArgumentDescription
date_value / datetime_value / timestamp_valueThe DATE, DATETIME or TIMESTAMP to truncate.
date_partDAY, WEEK, WEEK(<WEEKDAY>) (for example WEEK(MONDAY)), ISOWEEK, MONTH, QUARTER, YEAR or ISOYEAR. Unquoted. DATETIME and TIMESTAMP values also accept MICROSECOND, MILLISECOND, SECOND, MINUTE and HOUR.
time_zoneTIMESTAMP only: the time zone in which to find the period start, for example 'Europe/Prague'. Defaults to UTC.

Returns: The type of the first argument: for a DATE, the first day of the period that contains it; for a DATETIME or TIMESTAMP, the first instant of the period.

Examples

First day of the month, quarter and year

SELECT
  DATE_TRUNC(DATE '2026-11-23', MONTH)   AS month_start,
  DATE_TRUNC(DATE '2026-11-23', QUARTER) AS quarter_start,
  DATE_TRUNC(DATE '2026-11-23', YEAR)    AS year_start;
Result
month_startquarter_startyear_start
2026-11-012026-10-012026-01-01

Sunday weeks, Monday weeks and ISO weeks

2026-11-25 is a Wednesday. WEEK goes back to the previous Sunday; WEEK(MONDAY) and ISOWEEK go back to Monday.

SELECT
  DATE_TRUNC(DATE '2026-11-25', WEEK)         AS week_sunday,
  DATE_TRUNC(DATE '2026-11-25', WEEK(MONDAY)) AS week_monday,
  DATE_TRUNC(DATE '2026-11-25', ISOWEEK)      AS iso_week;
Result
week_sundayweek_mondayiso_week
2026-11-222026-11-232026-11-23

Monthly revenue

WITH orders AS (
  SELECT DATE '2026-01-14' AS order_date, 120 AS amount UNION ALL
  SELECT DATE '2026-01-30', 80 UNION ALL
  SELECT DATE '2026-02-02', 50
)
SELECT
  DATE_TRUNC(order_date, MONTH) AS month,
  SUM(amount) AS revenue
FROM orders
GROUP BY month
ORDER BY month;
Result
monthrevenue
2026-01-01200
2026-02-0150

Truncating TIMESTAMP and DATETIME values

03:30 UTC on November 23 is 22:30 on November 22 in New York, whose local midnight is 05:00 UTC.

SELECT
  DATE_TRUNC(TIMESTAMP '2026-11-23 03:30:00+00', DAY) AS utc_day,
  DATE_TRUNC(TIMESTAMP '2026-11-23 03:30:00+00', DAY, 'America/New_York') AS ny_day,
  DATE_TRUNC(DATETIME '2026-11-23 18:45:30', HOUR) AS datetime_hour;
Result
utc_dayny_daydatetime_hour
2026-11-23 00:00:00 UTC2026-11-22 05:00:00 UTC2026-11-23T18:00:00

ISO years can start in December

ISO week 1 is the week that contains the first Thursday of January. In 2026 that week starts on Monday, December 29, 2025.

SELECT DATE_TRUNC(DATE '2026-01-01', ISOYEAR) AS iso_year_start;
Result
iso_year_start
2025-12-29

Common mistakes

  • Writing the arguments in PostgreSQL order. DATE_TRUNC('month', order_date) fails in BigQuery; write DATE_TRUNC(order_date, MONTH).
  • Expecting Monday weeks from WEEK. WEEK starts on Sunday; use WEEK(MONDAY) or ISOWEEK.
  • Mixing ISOYEAR with calendar years. Up to three days at the start or end of a year belong to the neighbouring ISO year.
  • Truncating a TIMESTAMP in UTC by accident. A 23:30 event in New York already falls on the next day in UTC. Pass the zone: DATE_TRUNC(ts, DAY, 'America/New_York'), or convert first with DATE(ts, 'America/New_York').

Cost and performance

  • DATE_TRUNC itself is cheap. On-demand cost depends on the bytes scanned, not on the functions you call.
  • To filter a date-partitioned table by month, a range on the partition column (order_date >= '2026-11-01' AND order_date < '2026-12-01') is the clearest option. DATE_TRUNC is one of the functions BigQuery can still prune partitions through when its other arguments are constants, but functions outside that list (for example FORMAT_DATE, or EXTRACT with MONTH) make the query scan and bill every partition. Check the estimate with a dry run.

FAQ

How do I get the first day of the month in BigQuery?

Use DATE_TRUNC(your_date, MONTH). For the last day of the month, use LAST_DAY: LAST_DAY(your_date, MONTH).

What is the difference between DATE_TRUNC and EXTRACT?

DATE_TRUNC returns a DATE, the start of the period. EXTRACT returns an INT64 part of the date, such as 11 for November, without the year. Group by DATE_TRUNC when a series spans several years.

How do I truncate a timestamp to a day in my time zone?

Use DATE_TRUNC(ts, DAY, 'Europe/Prague') or TIMESTAMP_TRUNC(ts, DAY, 'Europe/Prague'), which return a TIMESTAMP at local midnight, or DATE(ts, 'Europe/Prague'), which returns the local calendar date.

Errors you may hit

More date functions

All BigQuery date functions · All functions · BigQuery error messages

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.