首页 > 代码库 > jquery操作日期

jquery操作日期

 // date为日期,days为天数
function AddDays(date, days) { var nd = new Date(date); nd = nd.valueOf(); nd = nd + days * 24 * 60 * 60 * 1000; nd = new Date(nd); var y = nd.getFullYear(); var m = nd.getMonth() + 1; var d = nd.getDate(); if (m <= 9) m = "0" + m; if (d <= 9) d = "0" + d; var cdate = y + "-" + m + "-" + d + ‘ ‘+nd.getHours() + ‘:‘ + nd.getMinutes() + ‘:‘ + nd.getDate(); return cdate; }