日期:2014-05-16 浏览次数:20456 次
//追加日期 function addDay(dates,num) { var d=new Date(dates.replace(/-/g,"/")); d.setDate(d.getDate()+num); var tempday=d.getDate(); var tempmonth=(1+d.getMonth()); if(tempday.toString().length==1) tempday="0"+tempday; if(tempmonth.toString().length==1) tempmonth="0"+tempmonth; return d.getFullYear()+ "-"+tempmonth+ "-"+tempday; } //追加小时 function addHour(dates,num) { var d=new Date(dates.replace(/-/g,"/")); d.setHours(d.getHours()+num); var tempday=d.getDate(); var tempmonth=(1+d.getMonth()); var temphour=d.getHours(); var tempmin=d.getMinutes(); if(tempday.toString().length==1) tempday="0"+tempday; if(tempmonth.toString().length==1) tempmonth="0"+tempmonth; if(temphour.toString().length==1) temphour="0"+temphour; if(tempmin.toString().length==1) tempmin="0"+tempmin; return d.getFullYear()+ "-"+tempmonth+ "-"+tempday+" "+temphour+":"+tempmin; }?