SQL 根據生日和日期計算年齡
FLOOR(datediff(DY,p.Dob,o.RegisterTime)/365 ...
首先建立一個表如下: BirthDay datetime not null Age 通過公式計算得出 以上是表的兩個字段,通過BirthDay字段的數據自動生成Age字段 Age字段的公式如下: case when datediff year, BirthDay ,getdate lt gt then ltrim datediff year, BirthDay ,getdate 歲 else ca ...
2015-01-21 15:45 0 4627 推薦指數:
FLOOR(datediff(DY,p.Dob,o.RegisterTime)/365 ...
員的大概年齡,但不精確.不會精確到月或日. 按照上面測試的日期,該人員的實際年齡應該還不滿5歲。在需要精 ...
...
本例中用的是easyUI的datebox ...
該人員的大概年齡,但不精確.不會精確到月或日. 按照上面測試的日期,該人員的實際年齡應該還不滿5歲。在 ...
1、建立函數 Create Function [dbo].[GetAge](@BirthDay datetime)Returns varchar(20)AsBegin DECLARE @year ...
"); return sdf.parse(strDate); } 2.計算年齡 ...