-
-
Save mattm/160f2905a44e45d9be206ea494c94954 to your computer and use it in GitHub Desktop.
Milliseconds vs Seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
,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