goja-core/src/main/java/goja/core/kits/IdCardKit.java
public static int getAgeByIdCard(String idCard) {
        int iAge;
        if (idCard.length() == CHINA_ID_MIN_LENGTH) {
            idCard = conver15CardTo18(idCard);
        }
        String year = idCard.substring(6, 10);
        Calendar cal = Calendar.getInstance();
        int iCurrYear = cal.get(Calendar.YEAR);
        iAge = iCurrYear - Integer.valueOf(year);
        return iAge;
    }
public static int getAgeByIdCard(String idCard) {
        int iAge;
        if (idCard.length() == CHINA_ID_MIN_LENGTH) {
            idCard = conver15CardTo18(idCard);
        }
        String year = idCard.substring(6, 10);
        Calendar cal = Calendar.getInstance();
        int iCurrYear = cal.get(Calendar.YEAR);
        iAge = iCurrYear - Integer.valueOf(year);
        return iAge;
    }
public static int getAgeByIdCard ( String idCard ) { int iAge ; if ( idCard . length ( ) == CHINA_ID_MIN_LENGTH ) { idCard = conver15CardTo18 ( idCard ) ; } String year = idCard . substring ( 6 , 10 ) ; Calendar cal = Calendar . getInstance ( ) ; int iCurrYear = cal . get ( Calendar . YEAR ) ; iAge = iCurrYear - Integer . valueOf ( year ) ; return iAge ; }
根据身份编号获取年龄

@param idCard 身份编号
@return 年龄
根据身份编号获取年龄