From:             [EMAIL PROTECTED]
Operating system: any
PHP version:      4.0.5
PHP Bug Type:     Feature/Change Request
Bug description:  date() format addition

i live in sweden, where displaying weeknumbers in calendars of any sort is common. the 
following code does the work, tho i'd be very happy if it could be supported to be 
returned from the date() function.

the algorithm is (mondaynumber+7)/7
where mondaynumber is the day of the year of the monday of the current year

switch(date("w")) {
        case 1: $daysub=0; break;
        case 2: $daysub=1; break;
        case 3: $daysub=2; break;
        case 4: $daysub=3; break;
        case 5: $daysub=4; break;
        case 6: $daysub=5; break;
        case 0: $daysub=6; break;
$weeknumber=(date ("z", mktime(0,0,0, date("m"), date("d")-$daysub, date("Y")) )+7)/7;

Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to