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

DATEDIFF returns wrong value

$
0
0

Hi,

I have a simple statement below, which I expect to return values quarterly.  But with the given dates below it returns 1 and I expect 0 because there is no quarter passed between them.  Can anyone suggest what's wrong with this:

DECLARE @startDate AS DATE = '20090518'
DECLARE @endDate AS DATE = '20090701'

SELECT DATEDIFF(quarter, @startDate, @endDate)

I am using British format, but that shouldn't affect as the above date declaration should handle that correctly.

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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