var nowD = date.getFullYear() + "." + (date.getMonth() + 1) + "." +date.getDate()
date.setMonth(date.getMonth() - s)
var month = date.getMonth()
month = ((month==0)?(12):(month))
var befD = date.getFullYear() + "." + (date.getMonth() + 1) + "." +date.getDate()
我给你举个例子吧!就拿当前时间来说,下面是代码var now = new Date()
tomo = new Date((now/1000-86400*10)*1000)//先减去10天
var year = tomo.getYear()
var month = tomo.getMonth()//再减去一个月,当前月应该是tomo.getMonth()+1
var date = tomo.getDate()
month = (month<10)?"0"+month:month
date = (date<10)?"0"+date:date
var time = year+"/"+month+"/"+date//最终得到的时间