Skip to content Skip to sidebar Skip to footer

Converting Timestamps In Google Big Query (sql)

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, h

Solution 1:

Standard SQL in BigQuery

DATETIME(timestamp_expression, 'Europe/Berlin')

Solution 2:

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.

Post a Comment for "Converting Timestamps In Google Big Query (sql)"