Declare @bDate DateTime
set @bDate = ’1976-08-04′
Select ABS(DATEDIFF(month, @bDate, getdate()))/12 as[YEAR] , ABS(DATEDIFF(month, @bDate, getdate()))%12 as [MONTH]
set @bDate = ’1976-08-04′
Select ABS(DATEDIFF(month, @bDate, getdate()))/12 as[YEAR] , ABS(DATEDIFF(month, @bDate, getdate()))%12 as [MONTH]
Output:
YEAR MONTH
34 4
YEAR MONTH
34 4
No comments:
Post a Comment