gopi nath pandraju gopi nath pandraju - 9 months ago 56
SQL Question

Days between two dates In SQL Server

I am using

DATEDIFF(d, @Date, @ExDate) as T

to get the number of days between
. I got the number of days. But I want to the fraction T/365 for some calculation. If I do this I got 0 because it returns the time. What should I do to get that value?

Answer Source

Try This:

SELECT ( DATEDIFF(DAY, '2016-11-12', '2016-11-30') ) / 365.00