

Note that DATEDIFF returned 2 minutes although there is just 1 minute and 15 seconds between the datetime values. Result: 1 PostgreSQL - Date Difference in WeeksĬonsider SQL Server function to calculate the difference between 2 datetime values in minutes:
#PGADMIN 4 SCHEDULE EXECUTION FULL#
So you can use DATE_PART function to extact the number of days, but it returns the number of full days between the dates.

In PostgreSQL, if you subtract one datetime value (TIMESTAMP, DATE or TIME data type) from another, you will get an INTERVAL value in the form ” ddd days hh:mi:ss”. Note that DATEDIFF returned 2 days, although there is only 1 day and 2 hours between the datetime values. Consider SQL Server function to calculate the difference between 2 dates in days:
