Reputation: 539
I am extracting the time from timestamp using sql on gcp. The timestamp is
2020-05-10 06:14:25.276 UTC
My code is
SELECT
cast( Request_Timestamp as time) AS Time,
FROM conversation;
However, I got the result: 18:08:47.371000
What should I code so I will get the result like: 18:08:47
Thanks
Upvotes: 0
Views: 58
Reputation: 172984
Below is for BigQuery Standard SQL
#standardSQL
SELECT TIME_TRUNC(TIME(Request_Timestamp), SECOND) AS Time
FROM `project.dataset.conversation`
So when applied to 2020-05-10 06:14:25.276 UTC timestamp - output it
Row Time
1 06:14:25
Upvotes: 1