note 18821 added to function.date
| From: | madsen_at_sjovedyr dot dk at php2 dot chek dot com | Date: | Wed, 06 Feb 2002 18:28:56 +0000 |
| Subject: | note 18821 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26306@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.
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+18821
http://master.php.net/manage/user-notes.php?action=delete+18821
http://master.php.net/manage/user-notes.php?action=reject+18821