note 60047 added to function.date
| From: | Andrew at osu1 dot php dot net | Date: | Fri, 23 Dec 2005 21:54:00 +0000 |
| Subject: | note 60047 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100640@lists.php.net to get a copy of this message | ||
Simplistic, but useful. Determining which quarter of the year you're in (assuming the 1st
starts in Jan and the 4th ends in Dec):
<?
$month = ceil(date('n')/3);
?>
Where it might be used:
<?
$month = ceil(date('n')/3);
$suffix = array('st','nd','rd','th');
echo "$month{$suffix[$month - 1]} Quarter"; // e.g. in April, "2nd Quarter" is
printed
?>
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60047
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60047&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60047&report=yes
Search -- http://master.php.net/manage/user-notes.php