On Sat, May 07, 2011 at 07:07:29PM +0100, Martin A. Brooks wrote:
On Sat, May 7, 2011 18:39, Chris G wrote:
I'd like to output dates like:-
1st September 2009 23rd August 1967
I.e. I want the 'st' and 'rd' suffixes for the day. It doesn't look like strftime() offers an option to do this. I can obviously do it myself with a switch/case or some if/then/else statements but I was wondering if there's anything ready-made that I've missed.
Perl can do this:
martin@olga:~$ perl -e 'use Date::Format; @lt = localtime(time); print strftime("%o %B %Y\n", @lt);' 7th May 2011
Hmm, interesting, my man page for strftime() doesn't show the %o at all so either it's a perl'ism or not all strftime()'s are born equal. It's not in PHP's strftime(), I just tried it. ... nor is it in Python's strftime().
Thank you anyway, the next question is whether I embed a little bit of perl in the PHP or just diy it.