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);
继续阅读与本文标签相同的文章
上一篇 :
短信提交验证
-
阿里云智能大学训练营讲师培训
2026-05-19栏目: 教程
-
SQL 中 Left Join 转为 Inner Join 的实际应用
2026-05-19栏目: 教程
-
82天突破1000star,项目团队梳理出软件开源必须注意的8个方面
2026-05-19栏目: 教程
-
是真“开发者”,就来一“测”到底!
2026-05-19栏目: 教程
-
山西晋城携手阿里构建城市云平台,66个政务系统已上云
2026-05-19栏目: 教程
