var time = new Date(); //当前时间 var year = time.getFullYear();//当前年份 var month = time.getMonth()+1; //当前月份 var Same_day = time.getDate(); //当前月份几号 var time1 = new Date(year,month,1-1); var Last_day = time1.getDate();//当前月份的最后一天 var week = new Date(year,month-1,1).getDay();//获取当月1号在周几 time.setMonth(5)//设置月份5代表六月份 console.log(year+"年"+month+"月"+Same_day+"日"+",本月共有"+Last_day+"天"+",周一在星期"+week);