function getWeek(dt) { let d1 = new Date(dt); let d2 = new Date(dt); d2.setMonth(0); d2.setDate(1); let rq = d1 - d2; let days = Math.ceil(rq / (24 * 60 * 60 * 1000)); let num = Math.ceil(days / 7); return num+1; } var ss = getWeek("2023-10-07") alert(ss);
标签:getWeek,几周,js,60,获取,num,let,dt,d2 From: https://www.cnblogs.com/ooo0/p/17745458.html