/**根据身份证计算年龄 *@param UUserCard 身份证号码 */
function IdCard(UUserCard) { //获取年龄 var myDate = new Date(); var month = myDate.getMonth() + 1; var day = myDate.getDate(); var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1; if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) { age++; } $("#age").val(age); }
时间: 2024-10-11 07:05:04