Jump to content

[SOLVED] SQL datetime data type help


waverider303

Recommended Posts

I have a row that is a datetime datatype (2009-09-09 11:05:03) I want to retreuieve this information and have it be displayed as this: September 9th, 2009

 

This is what I have so far:

$sql = "SELECT title, content, DATE_FORMAT(`date`,'%M %D, %Y') FROM news WHERE id=$id";
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);

$date = $row['date'];
$title = $row['title'];
$content = $row['content'];
echo "<h3 class=\"cufonH3\">$title</h3>";
echo "<div class=\"dates\">".$date."</div>";
echo "<p>$content</p>";

Everything but the date displays

Link to comment
https://forums.phpfreaks.com/topic/173688-solved-sql-datetime-data-type-help/
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.