25 Sep 18 · David-Spring ·       Add to Favorites  

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 Sep 18

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds

Copied