Last active
January 2, 2016 21:19
-
-
Save fredbenenson/8362536 to your computer and use it in GitHub Desktop.
Seconds since midnight?
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
-- Note that this doesn't work: | |
-- SELECT DATEDIFF(second, DATE(NOW()), NOW()); | |
-- => | |
-- ERROR: function pg_catalog.date_diff("unknown", date, timestamp with time zone) does not exist | |
-- HINT: No function matches the given name and argument types. You may need to add explicit type casts. | |
-- This does work: | |
SELECT DATEDIFF(second, DATE(NOW()), SPLIT_PART(NOW(), '.', 1)::timestamp); | |
randyzwitch
commented
Jan 10, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment