function getBirthdatByIdNo(iIdNo) { var tmpStr = ""; var idDate = ""; var tmpInt = 0; var strReturn = ""; iIdNo = iIdNo.replace(/^\s+|\s+$/g, ""); if (iIdNo.length == 15) { tmpStr = iIdNo.substring(6, 12); tmpStr = "19" + tmpStr; tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6) return tmpStr; }else{ tmpStr = iIdNo.substring(6, 14); tmpStr = tmpStr.substring(0, 4) + "-" + tmpStr.substring(4, 6) + "-" + tmpStr.substring(6) return tmpStr; } }
调用方法可以返回出生日期: yyyy-MM-dd