Log in

View Full Version : MySQL Timestamp into PHP Format



cancer10
03-17-2008, 02:22 AM
I have a timestamp column in a mysql table.

Using PHP, how do I convert the timestamp format which is "YYYY-MM-DD HH:MM:SS" into a format like "March 16 2008, 08:41 am" ?


Please help



Thanx

wmguk
03-17-2008, 03:43 AM
I have a timestamp column in a mysql table.

Using PHP, how do I convert the timestamp format which is "YYYY-MM-DD HH:MM:SS" into a format like "March 16 2008, 08:41 am" ?

Please help
Thanx

try something like this:


$showdate = date('M d Y, H:i a', strtotime($row['orderdate']));


change orderdate to the fieldname in your table, and just the echo $showdate..

check out http://uk3.php.net/date for the different formatting :)