Created
July 28, 2016 16:19
-
-
Save msammarco/4d3ec6b60459c7cdc2b57458194340f4 to your computer and use it in GitHub Desktop.
Postgresql - DATEDIFF UDF
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
-- Does just diffing between dates | |
CREATE OR REPLACE FUNCTION DATEDIFF(units VARCHAR(30), date, date) | |
RETURNS int | |
LANGUAGE sql | |
AS | |
$$ | |
SELECT abs(($2 - $3)::INTEGER) as DateDifference | |
$$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment