function getNextDate(date,day) { var dd = new Date(date); dd.setDate(dd.getDate() + day); var y = dd.getFullYear(); var m = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1; var d = dd.getDate() < 10 ? "0" +…
Date curDate = new Date();var preDate = new Date(curDate.getTime() - 24*60*60*1000); //前一天var nextDate = new Date(curDate.getTime() + 24*60*60*1000); //后一天…
function addDays(date, days,seperator='-') { let oDate = new Date(date).valueOf(); let nDate = oDate + days * 24 * 3600 * 1000; nDate = new Date(nDate); let y = nDate.getFullYear().toString().padStart(2, 0); let m = (nDate.getMonth() + 1).toString().…
var date = new Date(); alert(date);//获取当前时间 alert(date.getFullYear());//获取当前年分 alert(date.getMonth());//获取月份(获取当前月份要加1) alert(date.getDate());//获取当前日期的几号 alert(date.getDay());//获取当前是星期几 alert(date.getTime());//获取距离1970/01/01 至今的毫秒 settime()是向 1970/01…