日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 前端文檔 正文

js獲取上個月第一天和最后一天(layui)

作者:傻的太壞 更新時間: 2024-03-05 前端文檔
var nowdays = new Date();
var year = nowdays.getFullYear();
var month = nowdays.getMonth();
if (month == 0) {
    month = 12;
    year = year - 1;

}
if (month < 10) {
    month = '0' + month;
}

var myDate = new Date(year, month, 0);

var startDate = year + '-' + month + '-01 00:00:00'; //上個月第一天
var endDate = year + '-' + month + '-' + myDate.getDate() + ' 23:59:00'; //上個月最后一天

原文鏈接:https://blog.csdn.net/weixin_38897313/article/details/121956129

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新