4.8/5
Home

Integrations

Plug Count neatly into your existing data infrastructure

For data teams

Collaborative, AI-driven data exploration and modelling

For product & growth

Faster access to the answers which matter

For leaders

Turning data into an engine of improvement

Pricing

Latest post

Meet the new Count Agent

Meet the new Count Agent

Docs

Guides, references, and API docs

Blog

Opinions, analysis, and the occasional uncomfortable truth about data.

Webinars

Join our experts for deep dives into data analytics and business intelligence

Gallery

Browse ready-to-use canvas templates and try them instantly

Sign in

Where to begin?

Start for free

Spin up a canvas and explore your data — a couple of clicks, no card.

Book a demo

See it live. Bring your questions — we’ll bring the answers.

Still not sure?

Send us a note — we’ll point you the right way.

Data to decisions, faster.

Compare

  • Count vs BI
  • Count vs Notebooks
  • Count vs Chatbots
  • Count vs Hex
  • Count vs Looker
  • Count vs Tableau
  • Count vs Thoughtspot

Learn

  • Blog
  • Webinars
  • SQL tutorials

Legal & security

  • Privacy Policy
  • Terms of Use
  • Cookies Policy
  • Trust Center
  • Security

Social

  • LinkedIn →
  • YouTube →
  • X →

Start with the hard question.

Ask Count anything — we’ll take you straight into a canvas.

Opens sign-up with your prompt ready for Count.

© 2026 Count Technologies Ltd. All rights reserved.

Careers →Book a Demo →
count

SQL Resources

Count is the best SQL IDE, wrapped up in the best data analysis tool, all inside the best BI platform.

ARRAY_AGG
Arrays Explained
Arrays Explained
CASE
CAST
COALESCE
CONCAT
COUNT [DISTINCT]
CURRENT_DATE
CURRENT_DATETIME
CURRENT_TIMESTAMP
DATETIME_DIFF
DATETIME_TRUNC
DATE_DIFF
DATE_TRUNC
Data Types
Dates and Times
EXTRACT
IF
MEDIAN
SUBSTR
String Functions Explained
TIMESTAMP_DIFF
TIMESTAMP_TRUNC
TIME_DIFF
TIME_TRUNC
DefinitionPractical InfoCommon QuestionsTroubleshooting Common ErrorsRelated Pages
UNNEST
Window Functions Explained
SQL Resources/BigQuery Standard SQL/TIME_TRUNC

TIME_TRUNC

TIME_TRUNC function. Definition, syntax, examples and common errors using BigQuery Standard SQL. The TIME_TRUNC function in BigQuery will truncate the time to the given date_part.

ℹ️

See also DATE_TRUNC, DATETIME_TRUNC, TIMESTAMP_TRUNC

Definition

The TIME_TRUNC function in BigQuery will truncate the time to the given date_part.

Where part can be any of the following:

TIME_TRUNC(time_expression, part)
  • MICROSECOND
  • MILLISECOND

Returns: TIME

originaltruncated
10:00:4410:00:00

Practical Info

  • Always returns a TIME so if you want to do any arithmetic you'll need to continue to use TIME functions like TIME_DIFF. Or you can use EXTRACT to convert to an INT64.

Common Questions

How do I aggregate my data by hour?

TIME_TRUNC is very handy for aggregating your data by a particular date_part, like HOUR. See the example below to see how you can aggregate by HOUR:

SELECT
  CAST('10:00:44' AS TIME) AS original,
  TIME_TRUNC(CAST('10:00:44' AS TIME), HOUR) AS truncated
totalhour
312:00:00
707:00:00
2717:00:00

Make sure you've included your TIME_TRUNC column in your GROUP BY!

Troubleshooting Common Errors

Argument 1 of TIME_TRUNC has incorrect type: expected time found date.

SELECT
  SUM(number) AS total,
  TIME_TRUNC(time, HOUR) AS hour
FROM
  (
    SELECT
      CAST('12:50:01' AS TIME) AS time,
      3 AS number
    UNION ALL
(    SELECT
      CAST('07:42:41' AS TIME) AS time,
      7 AS number)
    UNION ALL
(    SELECT
      CAST('17:01:00' AS TIME) AS time,
      27 AS number)
  ) AS table_3
GROUP BY
  hour

You'll need to make sure you're using the right function for your data type. To use TIME_TRUNC you must be working with a TIME - not a DATE, DATETIME, or TIMESTAMP.

You can use CAST to change your other date types to TIME, or use one of the equivalent functions for other date types like DATE_TRUNC.

Related Pages

  • TIMESTAMP_TRUNC
  • Dates and Times in Standard SQL

Got a CSV?
See it differently in <2 mins

Get started for FREEWatch our CEO do it