note 13618 added to function.getdate.php
| From: | doiveo at hotmail dot com | Date: | Mon, 25 Jun 2001 05:05:22 +0000 |
| Subject: | note 13618 added to function.getdate.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14614@lists.php.net to get a copy of this message | ||
switch is a bit cleaner method for adding date suffixes:
<P>$my_date = getdate($timestamp);
$my_day = $my_date['mday'];
<P>switch ($my_date['mday']) {
case '1':
case '21':
case '31':
$my_day .= 'st';
Break;
case '3':
case '23':
$my_day .= 'rd';
Break;
case '2':
case '22':
$my_day .= 'nd';
Break;
default:
$my_day .= 'th';<BR>
}
http://www.php.net/manual/en/function.getdate.php