Sorry, I did not gave you any code that counts weeks for given date
Here is my code shorthand:
alias KN { return $ceil($calc($calc($gettok($duration($calc($ctime($1 $+ / $+ $2 $+ / $+ $3) - $ctime(01/01/ $+ $3)),3),1,58)+24) /168)) }
And for you, to understand it:
extended version:
alias KN {
var %now = $ctime($1 $+ / $+ $2 $+ / $+ $3)
var %1jan = $ctime(01/01/ $+ $3)
var %period = $calc(%now - %1jan)
var %periodinhours = $gettok($duration(%period,3),1,58)
var %periodplusday = %periodinhours + 24
var %countweeksinperiod = %periodplusday / 168
return $ceil(%countweeksinperiod)
}
Use of code: $KN(dd,mm,yyyy)
I noticed, this, my called - bug, when tryed to fix this code with addon, that counts days in year, to make script udnerstand, if this is leap year, or not, and depending on that, correct calculation by exact days... And when I counted days, I god realy confused...
$calc($gettok($duration($calc($ctime(31/12/2008) - $ctime(01/01/2008)),3),1,58)/24)
This code tells, that we have only 365 days this year, BUT, we have 356!
Now, your suggestion made little gray mass in my mind to start moving
$calc($gettok($duration($calc($ctime(01/01/2009) - $ctime(01/01/2008)),3),1,58)/24)
Now, I will try use this code, to make correction in weeknumber code... Want to help me?
PS: You can move this post to topick, you think is best place for it...