引入XDate.JS 这个小插件,不知道的百度谷歌吧

代码如下:

var firstDate = new Date();

firstDate.setDate(1); //第一天

var endDate = new Date(firstDate);

endDate.setMonth(firstDate.getMonth()+1);

endDate.setDate(0);

alert("第一天:"+new XDate(firstDate).toString('yyyy-MM-dd')+" 最后一天:"+new XDate(endDate).toString('yyyy-MM-dd'));

 

好了自己试试吧!

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案