note 45473 added to function.date

From: Date: Wed, 08 Sep 2004 16:22:23 +0000
Subject: note 45473 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-76235@lists.php.net to get a copy of this message
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!!!) ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45473 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45473&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45473&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76235) next »