kurtgn
kurtgn

Reputation: 8710

get date from unixtime in bigquery

I have a Firebase dataset in bigquery with a unixtime column:

SELECT user_first_touch_timestamp 
    FROM `smartsecurity2-fccc6.analytics_238757844.events_20200914`
    WHERE event_name="S_ad_click"

enter image description here

I need to convert it to date but don't understand how:


SELECT DATE(user_first_touch_timestamp) 
    FROM `smartsecurity2-fccc6.analytics_238757844.events_20200914`
    WHERE event_name="S_ad_click"


No matching signature for function DATE for argument types: INT64. 
Supported signatures: DATE(TIMESTAMP, [STRING]); DATE(DATETIME); DATE(INT64, INT64, INT64); DATE(DATE); DATE(STRING) at [1:8]

what's the proper way to do this?

Upvotes: 0

Views: 418

Answers (1)

Fahmi
Fahmi

Reputation: 37473

You can try the below - TIMESTAMP_MICROS()

SELECT TIMESTAMP_MICROS(user_first_touch_timestamp)
    FROM `smartsecurity2-fccc6.analytics_238757844.events_20200914`
    WHERE event_name="S_ad_click"

Upvotes: 2

Related Questions