日期:2014-05-18 浏览次数:20724 次
declare @t datetime
select @t='2007-3-20'
select case when day(@t)<=day(getdate()) then convert(varchar(10),datediff(month,@t,getdate()))+'个月零'+convert(varchar(10),datediff(day,@t,dateadd(month,-datediff(month,@t,getdate()),getdate())))+'天'
else convert(varchar(10),datediff(month,@t,getdate())-1)+'个月零'+convert(varchar(10),datediff(day,dateadd(month,datediff(month,@t,getdate())-1,@t),getdate()))+'天'
end