标签:io ar sp on log bs cti as new
var str = ‘501621199010285010‘;
(function(_str){
var str = _str;
var date1 = new Date();// 取得当前日期
var year1 = date1.getFullYear()/1;// 取得当前年份
var month1 = date1.getMonth()/1+1;// 取得当前月份
if (month1 > parseInt(str.substr(10, 2))){// 判断当前月分与编码中的月份大小
console.log(year1 - str.substr(6, 4));
return year1 - str.substr(6, 4);
}else{
console.log(year1 - str.substr(6, 4)/1 - 1);
return year1 - str.substr(6, 4)/1 - 1;
}
})(str);
标签:io ar sp on log bs cti as new
原文地址:http://my.oschina.net/comfiger/blog/355272