SELECT (CASE WHEN ( cast(DATEDIFF(Year, '2012-04-26', '2013-03-15') as int) = 0) THEN cast(DATEDIFF(MONTH, '2012-04-26', '2013-03-15') as varchar) +' Month' ELSE cast(DATEDIFF(Year, '2011-04-26', '2013-03-15')as varchar) +'Years '+ cast(DATEDIFF(MONTH, '2012-04-26', '2013-03-15')as varchar) +'Month' end) as diff;
select DATEDIFF(year, '1/1/1960', GETDATE()) AS Totalyears, DATEDIFF(month, '1/1/1960', GETDATE()) AS TotalMonths, DATEDIFF(month, '1/1/1960', GETDATE())/12 AS Years02, DATEDIFF(month, '1/1/1960', GETDATE())%12 AS RemainingMonths
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)