发现网上用js获取某月最后一个的方式大多比较复杂,上个简单的:

new Date(2013,4).toJSON().substring(0,10)

new Date(2013,4,0).toLocaleFormat('%Y-%m-%d')

显示"2013-04-30"

year+'-'+month+'-'+new Date(year,month,0).getDate();//获取当月最后一天日期

 

 

OK。

另外,前两种方法貌似IE上兼容性有问题,自己看着用吧

 

相关文章:

  • 2022-12-23
  • 2022-01-15
  • 2021-06-16
  • 2021-09-06
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2020-12-19
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案