Skip to content

Instantly share code, notes, and snippets.

@mattm
Last active November 12, 2018 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattm/160f2905a44e45d9be206ea494c94954 to your computer and use it in GitHub Desktop.
Save mattm/160f2905a44e45d9be206ea494c94954 to your computer and use it in GitHub Desktop.
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