JS 获取下个月日期方法
获取下一个月一号
const nextMonth = function () {
let now = new Date();
let month = now.getMonth()+1;
let year = now.getFullYear();
if ( month === 12 ) {
year += 1;
month = '01';
} else {
month += 1;
month = (month < 10) ? '0'+month : month;
}
return `${year}-${month}-01`
}
获取30天后时间
var now = new Date()
var seconds = 60*60*24*30*1000;
var timestamp = now.getTime();
var newDate = timestamp+seconds;
console.log(new Date(newDate));
公众号:爱加菲猫Mike
对电影、音乐视频
感兴趣 微信公众号搜索: 爱加菲猫Mike
完~~~~