DATEDIFF wrong day result

394 views Asked by At

I have problem in using DATEDIFF in sql.

DATEDIFF(DAY,@SimdikiTarih,DATEADD(YEAR,5,t.yenitarih)) AS KalanGun

Here @SimdikiTarih='10.06.2015' date of today and t.yenitarih='03.04.2011' (day.month.year)

The result is 298. Won't it be 293?

Thank you!

1

There are 1 answers

0
Chiragkumar Thakar On BEST ANSWER

It is showing 298 days, but still if you are not getting proper result then Try below query, Convert string to date.

SELECT DATEDIFF(DAY,CONVERT(DATE,@SimdikiTarih,103),DATEADD(YEAR,5,CONVERT(DATE,t.yenitarih),103))) AS KalanGun