Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Datediff off by one day?

$
0
0

Why would Datediff return 6 and not 7 ?

    DECLARE @dt1 DATETIME
    DECLARE @dt2 DATETIME

    SET @dt1 = '05/27/2014'
    SET @dt2 = '06/02/2014'

    SELECT DATEDIFF(DAY,@dt1,@dt2) AS DateDiffVal

This returns 6 but looking at the calendar, it should be 7 if you include the start date ????


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>