js获取当前时间是本年的第几天第几周

 
let d1 = new Date()
let d2 = new Date()
d2.setMonth(0)
d2.setDate(1)
let rq = d1-d2
let s1 = Math.ceil(rq/(24*60*60*1000))
let s2 = Math.ceil(s1/7)
console.log('第' + s1 + '天,第' + s2 + '周')

猜你喜欢

转载自www.cnblogs.com/wangqiao170/p/9282384.html