function myget(oldDate,Money)
{
year=oldDate.substring(0,4);
month=oldDate.substring(5,7);
day=oldDate.substring(8,10);
addMonth=parseInt(Money/10);
month=parseInt(month)+addMonth;
year=parseInt(year)+parseInt(month/12);
month=month%12+'';
if(month.length==1)
{
month='0'+month;
}
return(year+'-'+month+'-'+day)
}
调用方法newdate=myget('1999-10-10',10);
//注:参数oldDate必须为以上格式。月必须为两位;
{
year=oldDate.substring(0,4);
month=oldDate.substring(5,7);
day=oldDate.substring(8,10);
addMonth=parseInt(Money/10);
month=parseInt(month)+addMonth;
year=parseInt(year)+parseInt(month/12);
month=month%12+'';
if(month.length==1)
{
month='0'+month;
}
return(year+'-'+month+'-'+day)
}
调用方法newdate=myget('1999-10-10',10);
//注:参数oldDate必须为以上格式。月必须为两位;
1.如果月数正好是12,求模后是0,月份就是00了;
2.如果用户在2/28日交了3个月,不应是5/28,而应该是5月的最后一天。