Julius Knafl
Julius Knafl

Reputation: 429

Converting a custom timestamp to date

I have a table on BigQuery with one of the columns being "timestamp". This column is of datatype INT64. I want to add a new column based on that column with the exact dates.

The data in the timestamp column is as follows: -600 represents 19:00 EDT on Sunday May 1, 2011 -It is in microseconds, for e.g In one record there is 2506199602819 as the timestamp, this should be around 29 days after.

What would be the right way to proceed with this? I'm having this table on BigQuery but any SQL would be helpful.

Upvotes: 1

Views: 95

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269763

You can do:

select timestamp_add(timestamp('2011-05-01T19:00:00', 'America/New_York'), interval 2506199602819 - 600 microsecond)

Upvotes: 3

Related Questions