note 60047 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 15 Jan 2006 12:34:36 +0000 |
| Subject: | note 60047 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101803@lists.php.net to get a copy of this message | ||
Note Submitter: Andrew
----
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
?>