原文:SQL 根據日期精確計算年齡

第一種: 一張人員信息表里有一人生日 Birthday 列,跟據這個列,算出該人員的年齡 datediff year,birthday,getdate 例:birthday getDate 結果為: 這樣結果是會返回該人員的大概年齡,但不精確.不會精確到月或日. 按照上面測試的日期,該人員的實際年齡應該還不滿 歲。在需要精確年齡的時候,就會有錯. 第二種: FLOOR datediff DY,bi ...

2012-08-24 13:48 0 37171 推薦指數:

查看詳情

SQL通過日期計算年齡

首先建立一個表如下: ======================= BirthDay  datetime not null Age    通過公式計算得出 ======================= 以上是表的兩個字段,通過BirthDay字段的數據自動生成Age字段 Age字段 ...

Wed Jan 21 23:45:00 CST 2015 0 4627
C#根據出生日期和當前日期計算精確年齡

C#根據出生日期和當前日期計算精確年齡更多 0c#.net基礎 public static string GetAge(DateTime dtBirthday, DateTime dtNow){ string strAge = string.Empty; // 年齡的字符串表示 int ...

Thu Feb 09 23:30:00 CST 2017 0 3331
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM