I have two dates in which I would like to find the number of years between them, however I will need to show the value up to two decimal places. I tried the following, but always get a return value of 0, since all my dates do not span the whole year:
DATEDIFF(yy, @EndDateTime, i.mat_exp_dte)
Then I tried to find the number of days between them and then divide it by 365, but this still returns 0:
DATEDIFF(dd, @EndDateTime, i.mat_exp_dte)/365
Now confused how to calculate this. Do I need to convert a DataDiff to a different data type?
source
share