View Full Version : MySQL Timestamp into PHP Format

03-17-2008, 03: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


03-17-2008, 03:23 AM
http://uk.php.net/date has a list of all the available date functions.

03-17-2008, 03:31 AM
Use the mysql date_format() function in your select query - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format

If you do this using slow php code, you must use a strtotime() function and a date() function to end up with the same results as one mysql function.

03-17-2008, 03:47 AM
Yes, I have looked into that already. Doesnt solve my purpose. :(

03-17-2008, 12:17 PM
date_format(date_column, '%M %d %Y, %l:%i %p');
How does this not solve your purpose?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum