25 September 2018 · David-Spring ·       Add to Favorites   Report

How to extract just the hour from Timestamp in BigQuery?

To extract just the hour of a timestamp using standard SQL?

You can use EXTRACT(HOUR FROM your-timestamp-column)

for example:

SELECT EXTRACT(HOUR FROM CURRENT_TIMESTAMP())   

or

SELECT EXTRACT(HOUR FROM TIMESTAMP '2018-07-09T02:40:23.652Z')

or

SELECT EXTRACT(HOUR FROM TIMESTAMP('2018-07-09T02:40:23.652Z'))

David-Spring

posted on 25 September 2018

Read great educational content like this and a lot more !

Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too

Copied