PDA

Click to See Complete Forum and Search --> : [RESOLVED] Format MySQL DATETIME


DigiRev
Apr 2nd, 2007, 06:10 PM
Edit: Sorry, stupid mistake on my part. Got it resolved. :o

Here's what I got:

//Where I get the database entry into a variable.
$data = mysql_fetch_array($results, MYSQL_ASSOC);

//Format with strtotime.
$entry_date = strtotime($data['date']);

//Format with date.
$entry_time = date("l, jS F, Y h:i:s a", $entry_date);

//Displaying.
echo '<h3>' . $data['title'] . ' (' . $entry_time . ')</h3>';