Convert MySQL Timestamp into a Nicer-looking Date Format for PHP
Monday, January 11th, 2010After spending 20 minutes searching online for a way to convert the date stored into MySQL into a human-readable format in php, I thought I would share my solution with the world.
Assuming you’re already doing a foreach or a loop to pull your MySQL variable (in this case, the ($row['timestamp']) below), use the following code:
$date = strtotime($row['timestamp']);
$date = date(’n/d/Y, g:ia’, $date);
echo $date;
Hopefully that will save sometime time.