Reputation: 6041
I've returned a timestamp in google big query that looks like this:
2019-08-24 19:46:41 UTC
From looking at the raw data, I know that the actual time is 2019-08-24 19:46:31 EST
, however, I think it was automatically converted to UTC since I used the timestamp_seconds
function. I was wondering if there was a way to convert this to EST without subtracting 5 hours, since I know that in reality the time is correct, just the timezone is wrong.
Thanks!
Upvotes: 0
Views: 341
Reputation: 1269543
Just convert to a datetime
:
select datetime(timestamp_expression)
You can now interpret this in whatever timezone you like.
I would strongly, strongly discourage you from putting anything other than UTC in a timestamp
data type (a date/time value with a timezone offset is fine). It represents a point-in-time, which is best represented consistently as UTC.
Upvotes: 0
Reputation: 32003
Standard SQL in BigQuery
DATETIME(timestamp_expression, 'Europe/Berlin')
Upvotes: 1