Formatting date to human readable format

soniccool picture soniccool · Oct 3, 2013 · Viewed 45.6k times · Source

Lets say in my mysql database I have a timestamp 2013-09-30 01:16:06 and lets say this variable is $ts.

How can I output this to show more like September 30th, 2013?

Answer

Juan Cortés picture Juan Cortés · Oct 3, 2013
$timestamp = "2013-09-30 01:16:06";
echo date("F jS, Y", strtotime($timestamp)); //September 30th, 2013

Note the use of S to get the english ordinal suffix for the day.
Since you're already using strtotime if you need a human readable data for the current time you can just use the keyword "now" as in strtotime("now")

Related sources