JY2k
JY2k

Reputation: 2909

Bigquery extract hour from UTC timestamp

How can I extrac the hour from a DATETIME() of the following format:

2019-05-03T04:20:11.853290

When I use the EXTRACT() function it simply returns all values 0:

EXTRACT(HOUR FROM '2019-05-03T04:20:11.853290')

Upvotes: 1

Views: 2113

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172984

You can use

EXTRACT(HOUR FROM DATETIME '2019-05-03T04:20:11.853290')

or

EXTRACT(HOUR FROM TIMESTAMP('2019-05-03T04:20:11.853290'))  

Upvotes: 1

Related Questions