View Full Version : change data time format

04-10-2003, 03:19 AM
when I retrieve my date and time from database and display as follow:

2003-03-14 14:42:18

How can I easily change the format into :

Mar 14th, 2003, 2:42pm

04-10-2003, 06:42 AM
$date = date("F j, Y, g:i a", $retrieved_from_db);
echo $date;

You can check this page for more info on the date function and other formatting options :

This will work only if the date stored in your db is stored as a unix timestamp which means you got it with the time() function.