P
ROTOTYPE
I'm Not Only The Prototype, I'm Also A Member.
home
▪
stats
▪
search
▪
linkback
▪
about
▪
FAQ
| user: guest,
login
,
register
Date
:
Get week
author:
xum
[+]
,
Submitted: 04.15.01 9a
// nbr of the week -- ::xum::.org Date.prototype.getWeek = function(){ var a = this.getFullYear(), m = this.getMonth()+1, j = this.getDate(); var S = Math.floor(a/100), A = a%100; var aB = (a%4==0 && a%100!=0) || (a%1000==0) ? 1: 0; var jNA = (5*S + Math.floor(S/4) + A + Math.floor(A/4) + aB*6)%7; var w = Math.floor((jNA+(m==1 ? j: m==2 ? 31+j: Math.floor((30.6*m)-32.3)+j+aB*1)+5)/7)-Math.floor(jNA/5); return (w==0 || w==53 ? 1: w); }
msg
1
{
alfgear
[+]
, posted: 11.26.04 6a•-, top
[^]
}
Problem in function !
2000 January 1 and 2 fall on the last week of 1999 December. function should return 52 instead of 1 for these two dates. How to solve this?
Wrong :
1 27 28 29 30 31 1 2
2 3 4 5 6 7 8 9
3 10 11 12 13 14 15 16
4 17 18 19 20 21 22 23
5 24 25 26 27 28 29 30
6 31 1 2 3 4 5 6
Should be :
52 27 28 29 30 31 1 2
1 3 4 5 6 7 8 9
2 10 11 12 13 14 15 16
3 17 18 19 20 21 22 23
4 24 25 26 27 28 29 30
5 31 1 2 3 4 5 6
Thanks
msg
2
{
megamilam
[+]
, posted: 07.11.07 9p•07.11.07 9p, top
[^]
}
This is amazing! I've been looking for this code for days. Thanks!
Can you show me the usage? I'm trying to add the week number to an image name:
i.e. image52.jpg
And I'm having a difficult time figuring out how to make it happen.
Thanks for your help
Dave Milam
Add Comment
[+]
›opyleft 2001-2010. Layer51 is: Jaime Prado.
@