How to extract just the hour from Timestamp in BigQuery?

\n\n

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

\n\n

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

\n\n

for example:

\n\n
SELECT EXTRACT(HOUR FROM CURRENT_TIMESTAMP())   \n
\n\n

or

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

or

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

David-Spring

posted on

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