根据身份证号码生成生日和性别

 String   ls_date,ls_id,ls_sex,ls_month,ls_day,ls_year
 Date   ld_birthday
 ls_id =
 data
  If Len(ls_id) 
= 15
 Then   
    ls_date 
= Mid(ls_id,7,6
)
    ls_sex 
= MID(ls_id,15,1
)
    ls_year 
= Mid(ls_id,7,2
)
        ls_month 
= Mid(ls_id,9,2
)
    ls_day 
=Mid(ls_id,11,2
)
    ls_year 
= '19' +
 ls_year
 ElseIf Len(ls_id) 
= 18
 Then
   ls_date 
= Mid(ls_id,7,8
)
   ls_sex 
= Mid(ls_id,17,1
)
   ls_year 
= Mid(ls_id,7,4
)
   ls_month 
= Mid(ls_id,11,2
)
     ls_day 
=Mid(ls_id,13,2
)
 Else
  MessageBox(
"错误","身份证号码只能为15位或18位,请重新输入!^_^' "
)
  
return 2

 End   If
 
 
if not (((Integer(ls_year))>=1900) and ((Integer(ls_year))<=2999 )) then
  messagebox(
'提示:','对不起,你输入的身份证号码年份不对,请检查'
)
  
return 2
  
 end 
if

  
if not (((Integer(ls_month))>=01) and ((integer(ls_month))<=12 )) then
  messagebox(
'提示:','对不起,你输入的身份证号码月份不对,请检查'
)
  
return 2

  end 
if
 
if not (((Integer(ls_day))>=01) and ((Integer(ls_day))<=31 )) then
  messagebox(
'提示:','对不起,你输入的日期份证号码不对,请检查'
)
  
return 2
  
 end 
if

 ls_date 
= Left(ls_date, Len(ls_date) - 4)+"-"+Mid(ls_date,Len(ls_date)-4+1,2)+ "-" + Right(ls_date,2 )   
 ld_birthday 
=
 Date(ls_date)
 
if Mod(integer(ls_sex),2)=0
 then
  ls_sex 
= ''

 
else
  ls_sex 
= ''
 end 
if 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值