Here you can find the source of getWeekNumber()
Date.prototype.getWeekNumber = function () { var d = new Date(+this); d.setHours(0, 0, 0, 0);//from www. ja v a 2s. c om d.setDate(d.getDate() + 4 - (d.getDay() || 7)); return Math.ceil((((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7); };
Date.prototype.getWeekNumber = function(){ const date = new Date(+this); date.setHours(0,0,0); date.setDate(date.getDate()+4-(date.getDay()||7)); return Math.ceil((((date-new Date(date.getFullYear(),0,1))/8.64e7)+1)/7); };
Date.prototype.getWeekNumber = function(){ var d = new Date(+this); d.setHours(0,0,0); d.setMilliseconds(0); d.setDate(d.getDate()+4-(d.getDay()||7)); return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); };
Date.prototype.getWeekNumber = function(){ var d = new Date(+this); d.setHours(0,0,0); d.setDate(d.getDate()+4-(d.getDay()||7)); return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); }; function(doc) { var docdate = new Date(doc.created_at); if (doc.type === "entry") ...
Date.prototype.getWeekNumber = function() { var target = new Date(this.valueOf()); var dauNumber = (this.getDay() + 6) % 7; target.setDate(target.getDate() - dauNumber + 3); var jan4 = new Date(target.getFullYear(), 0, 4); var dayDiff = (target - jan4) / 86400000; if (new Date(target.getFullYear(), 0, 1).getDay() < 5) { return 1 + Math.ceil(dayDiff / 7); else { return Math.ceil(dayDiff / 7);
Date.prototype.getWeekNumber = function(){ var d = new Date(+this); d.setHours(0,0,0); d.setDate(d.getDate()+4-(d.getDay()||7)); return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); };
Date.prototype.getWeekNumber = function () { var d = new Date(this); d.setHours(0, 0, 0); d.setDate(d.getDate() + 4 - (d.getDay() || 7)); return Math.ceil((((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7) + 1) / 7); };
Date.prototype.getWeekOfMonth = function () { var today = new Date(this.getFullYear(), this.getMonth(), this.getDate()); var firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1); return Math.ceil((((today - firstOfMonth) / 86400000) + firstOfMonth.getDay() + 1) / 7); };
Date.prototype.getWeekOfYear = function() { var d = new Date(+this); d.setHours(0,0,0); d.setDate(d.getDate()+4-(d.getDay()||7)); return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7))/7); };
Date.prototype.getWeekOfYear = function () { var now = this.getDayOfYear() + (4 - this.getDay()); var jan1 = new Date(this.getFullYear(), 0, 1); var then = (7 - jan1.getDay() + 4); document.write(then); return String.leftPad(((now - then) / 7) + 1, 2, "0");