note 45473 rejected from function.date by betz
| From: | betz@php.net | Date: | Wed, 08 Sep 2004 19:48:02 +0000 |
| Subject: | note 45473 rejected from function.date by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76246@lists.php.net to get a copy of this message | ||
Note Submitter: daniel_rainbow@yahoo
----
I wanted an english formatted date, when I say english I mean quite plain english, with st nd and th
(if you see what I mean)
<?PHP
$day = date(j);
if (($day == "1")||($day=="21")||($day=="31"))
{
$day = $day . "st ";
}
if (($day == "2")||($day=="22"))
{
$day = $day . "nd ";
}
if (($day == "3")||($day=="23"))
{
$day = $day . "rd ";
}
if (is_numeric($day))
{
$day = $day . "th ";
}
$date = date('l ') . $day . date('F Y g:i:s a');
print "$date";
?>
prints something like
Wednesday 8th September 2004 5:22:14 pm
which looks quite nice in log entries etc...
(I've always wanted a usefull comment here -my dream has come true!!!)