F.Patel F.Patel - 21 days ago 6
SQL Question

Getting difference betwen 2 dates

I have 2 dates which is start date and end date
let's say start date is 07/01/2015 and end date is 12/31/2017 so, difference is 2 years and 6 month but i need output as 2.5 years

How can I get output as 2.5 years?

Answer
Select DateDiff(DD,'07/01/2015','12/31/2017')/365.0

Returns

2.504109
Comments