Using the code
Here it is:
month += 1; var a = Math.floor((14-(month))/12);
var y = year+4800-a;
var m = (month)+(12*a)-3;
var jd = day + Math.floor(((153*m)+2)/5) +
(365*y) + Math.floor(y/4) - Math.floor(y/100) +
Math.floor(y/400) - 32045;
var d4 = (jd+31741-(jd%7))%146097%36524%1461;
var L = Math.floor(d4/1460);
var d1 = ((d4-L)%365)+L;
NumberOfWeek = Math.floor(d1/7) + 1;
Please ask in the forum below if you need help using the function.
Points of Interest
There are rules and ways in the Gregorian calendar that is not common all around the world. I believe USA dont use this week-number method. Consider this before implementing the function.
- getWeek 1.0 released
Tommy live in Tromsø, a city far up north in Norway. He does programming and webdevelopment for a living.