APIs & Integrations

oren_hac
参加者

How to convert hubspot timestamps to meaningful datetime?

解決

Hi,

We're importing the hubspot DB to our BigQuery.

On the hs.properties.hs_lifecyclestage_marketingqualifiedlead_date.value property I see strange value such as: 1525801948522, 1525774682022.

I could not figure out what timestamp they represent? (These are not Unix timestamps)
I want to convert them to a datetime which I could actually use SQL queries on.

Does anyone have an idea?

Many thanks,
Oren

1件の承認済みベストアンサー
oren_hac
解決策
参加者

How to convert hubspot timestamps to meaningful datetime?

解決

Replying to myself.
It is unix time - just need to divide by 1000.

元の投稿で解決策を見る

4件の返信
Stanz
参加者

How to convert hubspot timestamps to meaningful datetime?

解決

I know it's been three years, but I'm running into the same problem and I'm new to SQL. Can you show me how you've done this in BigQuery?

0 いいね!
fsilva
参加者

How to convert hubspot timestamps to meaningful datetime?

解決

Just use the Bigquery  TIMESTAMP_MILLIS  function 

 

In my case, the date from engagement table is a string so:

TIMESTAMP_MILLIS(CAST(created_at AS INT64))
0 いいね!
oren_hac
解決策
参加者

How to convert hubspot timestamps to meaningful datetime?

解決

Replying to myself.
It is unix time - just need to divide by 1000.

rentiner
参加者

How to convert hubspot timestamps to meaningful datetime?

解決

I was breaking my head until I found your own answer

$date = date("Y-m-d H:i:s", ($date/1000) );