根据身份证号提取出生日期
public static string BirthDate(string idNO) { try {
string strYear = string.Empty; string strMonth = string.Empty; string strDay = string.Empty; string strBirtyDate = string.Empty; if (idNO.Length == 18) { strYear = idNO.Substring(6, 4) + "年"; strMonth = idNO.Substring(10, 2) + "月"; strDay = idNO.Substring(12, 2) + "日"; strBirtyDate = strYear + strMonth + strDay; return strBirtyDate; } else if (idNO.Length == 15) { strYear = "19" + idNO.Substring(6, 2) + "年"; strMonth = idNO.Substring(8, 2) + "月"; strDay = idNO.Substring(10, 2) + "日"; strBirtyDate = strYear + strMonth + strDay; return strBirtyDate; } else { return "身份证位数不正确"; } } catch (Exception ex) { throw new Exception("身份证号传输错误" + ex.Message); } }