Skip to content

Instantly share code, notes, and snippets.

@mattm

mattm/milliseconds.sql Secret

Last active Nov 12, 2018
Embed
What would you like to do?
Milliseconds vs Seconds
# Good: Accounting for the timestamp being in millseconds
...
select email, (timestamp '1970-01-01 00:00:00 UTC' +
numtodsinterval(property_beacon_interest/1000, 'SECOND'))
at time zone 'utc') as created_at
from hubspot.contact
...
# Bad: Not realizing millseconds need to be handled differently
...
SELECT
EMAIL
,FROM_UNIXTIME(PROPERTY_BEACON_INTEREST) AS EXPRESSED_INTEREST_AT
FROM HUBSPOT.CONTACT
WHERE
PROPERTY_BEACON_INTEREST IS NOT NULL
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment