1 private int GetAgeBycode(string b_car_code) 2 { 3 string birthday = ""; 4 //处理18位的身份证号码从号码中得到生日和性别代码 5 if (b_car_code.Length == 18) 6 { 7 birthday = b_car_code.Substring(6, 4) + "-" + b_car_code.Substring(10, 2) + "-" + b_car_code.Substring(12, 2); 8 } 9 //处理15位的身份证号码从号码中得到生日和性别代码 10 if (b_car_code.Length == 15) 11 { 12 birthday = "19" + b_car_code.Substring(6, 2) + "-" + b_car_code.Substring(8, 2) + "-" + b_car_code.Substring(10, 2); 13 } 14 return birthday; 15 16 }