DateTime计算年龄
DateTime dateDOB = new DateTime(1983, 10, 4); int now = int.Parse(DateTime.Today.ToString("yyyyMMdd")); int dob = int.Parse(dateDOB.ToString("yyyyMMdd")); string dif = (now - dob).ToString(); string age = "0"; if (dif.Length > 4) age = dif.Substring(0, dif.Length - 4);