...

View Full Version : change data time format



kenny873
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

fractalbit
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 :
http://www.php.net/manual/en/function.date.php

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum