Bug #11555: date() format addition
| From: | martin at humany dot com | Date: | Tue, 19 Jun 2001 09:41:57 +0000 |
| Subject: | Bug #11555: date() format addition | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57237@lists.php.net to get a copy of this message | ||
From: martin@humany.com
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: http://bugs.php.net/?id=11555&edit=1