I use the following code to display the time of blog posts on my website:
strftime('%B %e, %Y',strtotime($row->date))
Which returns the following string:
November 7, 2011
How can I adapt the above code to show (..st, ..nd, ..rd, ..th) at the end of the number. So I can show the date as:
November 7th, 2011
etc.
You should use date()
like this:
echo date('F jS, Y',strtotime($row->date));
When using date()
, the S
character is replaced with st, nd, rd or th:
date("F jS, Y", strtotime($row->date))