标签:
//字符串转成时间 function getDate(strDate) { var date = eval(‘new Date(‘ + strDate.replace(/\d+(?=-[^-]+$)/, function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ‘)‘); return date; } //获取几天后的时间 function getAfterDate(d,n) { var year = d.getFullYear(); var mon = d.getMonth() + 1; var day = d.getDate(); if (day <= n) { if (mon > 1) { mon = mon - 1; } else { year = year - 1; mon = 12; } } d.setDate(d.getDate() +n); year = d.getFullYear(); mon = d.getMonth() + 1; day = d.getDate(); s = year + "-" + (mon < 10 ? (‘0‘ + mon) : mon) + "-" + (day < 10 ? (‘0‘ + day) : day); return s; }
标签:
原文地址:http://www.cnblogs.com/renfushuai/p/5096813.html