function getMonsDay() {
var nowTemp = new Date(); //当前时间
var oneDayLong = 24 * 60 * 60 * 1000; //一天的毫秒数
var c_time = nowTemp.getTime(); //当前时间的毫秒时间
var c_day = nowTemp.getDay() || 7; //当前时间的星期几
var m_time = c_time - (c_day - 1) * oneDayLong; //当前周一的毫秒时间
var monday = new Date(m_time); //设置周一时间对象
var m_year = monday.getFullYear();
var m_month = monday.getMonth() + 1;
var m_date = monday.getDate();
// console.log(m_year + "-" + m_month + "-" + m_date); //周一的年月日
var val = m_year + "-" + m_month + "-" + m_date;
// this.getDate(val);
}
js获取本周周一的日期
最新推荐文章于 2024-05-06 10:04:46 发布