note 18821 deleted from function.date by sniper
| From: | sniper@php.net | Date: | Sat, 18 Jan 2003 01:35:48 +0000 |
| Subject: | note 18821 deleted from function.date by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42322@lists.php.net to get a copy of this message | ||
In order to retrieve the week number in older versions of PHP (<4.1), you can, on Unix-like
systems, do it this way. (Unless PHP is running in safe mode.)
<?
function getWeek(){
$week =
date +%-W;
return intval($week)+1;
}
echo getWeek();
?>
This will return the current week (Note that the 'intval($week)+1' makes sure we start at
week number 1 and not at 0 like the date-function on *nix's.)
Also note the backtick operators, it's not quotationmarks but backticks.
It's not widely useable, but I hope someone can use it.