Public Function SfzToXb(身份证号 As String) As String
Dim i As Integer
If Len(身份证号) = 15 And IsNumeric(Right(身份证号, 1)) Then
i = CInt(Right(身份证号, 1))
End If
If Len(身份证号) = 18 And IsNumeric(Mid(身份证号, 17, 1)) Then
i = CInt(Mid(身份证号, 17, 1))
End If
If i Mod 2 = 0 Then SfzToXb = "女" Else SfzToXb = "男"
End Function
Public Function SfzToRq(身份证号 As String) As Date
Dim strRq As String
If Len(身份证号) = 15 Then
strRq = Mid(身份证号, 9, 2) & "/" & Mid(身份证号, 11, 2) & "/" & "19" & Mid(身份证号, 7, 2)
ElseIf Len(身份证号) = 18 Then
strRq = Mid(身份证号, 11, 2) & "/" & Mid(身份证号, 13, 2) & "/" & Mid(身份证号, 7, 4)
End If
If IsDate(strRq) Then SfzToRq = CDate(strRq)
End Function