Question: how to find difference between two dates in sql?
Answer: As shown clearly in the result, because 2016 is the leap year, the difference in days between two dates is 2×365 + 366 = 1096. Consider the following example: SELECT DATEDIFF(hour,'2015-01-01 01:00:00','2015-01-01 03:45:00'); It also returns two because the DATEDIFF() function returns an integer only.