Reputation: 430
I've the below column,
and I'd like to get the date in yyyy-mm-dd
format from the time_usec
column.
Any guidance is appreciated!
Upvotes: 0
Views: 3293
Reputation: 15266
One possible solution would be the following:
SELECT
TIMESTAMP_ADD(TIMESTAMP "1970-01-01 00:00:00+00",
INTERVAL 1635500264544000 MICROSECOND) AS t1;
Here we use the TIMESTAMP_ADD
function to add the microseconds value to the base epoch.
Upvotes: 1
Reputation: 172994
Use below
select time_usec, date(timestamp_micros(time_usec)) date
from your_table
Upvotes: 2