码迷,mamicode.com
首页 > Windows程序 > 详细

C# 通过身份证查询出生日期

时间:2015-01-30 19:12:26      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

 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         }

 

C# 通过身份证查询出生日期

标签:

原文地址:http://www.cnblogs.com/jiaguo648517982/p/4262699.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!