5-6 counties, county-level, district code;
7-8 digits for the year of birth (default 19xx births);
9-10 digits for birth month;
5-6 counties, county-level, district code;
7-10 digits for the year of birth (default 19xx births);
11-12 digits for birth month;
15-17 digits for the sequence number, where the 17th male is singular, female is even;
18 Bits for check digit
The following is an example code for obtaining personal information via JS via ID:
1 functionGetpersoninfofromcardid (cardId) {2 varPersonInfo = {};3 4 if(cardid.length==15 ){5 varYear=cardid.substr (6,2);6 varMonth=cardid.substr (8,2);7 varDay=cardid.substr (10,2);8Personinfo.birth = ' +year+ '-' +month+ '-' +Day ;9 TenYear = ' 19 ' +Year ; One varAge=NewDate (). getFullYear ()-Year ; APersoninfo.age =Age ; - - varSex=cardid.substr (11,3); the if(Sex%2 = = 0){ -Personinfo.sex = ' female '; -}Else{ -Personinfo.sex = ' Male '; + } - } + A if(cardid.length==18 ){ at varYear=cardid.substr (6,4); - varMonth=cardid.substr (10,2); - varDay=cardid.substr (12,2); -Personinfo.birth = year+ '-' +month+ '-' +Day ; - - varAge=NewDate (). getFullYear ()-Year ; inPersoninfo.age =Age ; - to varSex=cardid.substr (17,1); + if(Sex%2 = = 0){ -Personinfo.sex = ' female '; the}Else{ *Personinfo.sex = ' Male '; $ }Panax Notoginseng } - the returnPersonInfo; +}
Extracting personal information from your ID card