APIs & Integrations

oren_hac
Participant

How to convert hubspot timestamps to meaningful datetime?

Résolue

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 Solution acceptée
oren_hac
Solution
Participant

How to convert hubspot timestamps to meaningful datetime?

Résolue

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

Voir la solution dans l'envoi d'origine

4 Réponses
Stanz
Participant

How to convert hubspot timestamps to meaningful datetime?

Résolue

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 Votes
fsilva
Participant

How to convert hubspot timestamps to meaningful datetime?

Résolue

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 Votes
oren_hac
Solution
Participant

How to convert hubspot timestamps to meaningful datetime?

Résolue

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

rentiner
Participant

How to convert hubspot timestamps to meaningful datetime?

Résolue

I was breaking my head until I found your own answer

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