Possible Duplicate:
Displaying Date from database PHP
I’m using this method in an insert.php function from a form for a small CMS/blog I’m making.
All i want to know is how to change the now() format.
mysql_query("INSERT INTO Blog
(Date, Title, Message, Image)
VALUES(now(), '$_POST[Title]' , '$_POST[Message]' , '$_POST[Image]' ) ")
or die(mysql_error());
I have a page that is using an echo
echo "<h2>" . "Posted on: " . $row['Date'] . "</h2>";
and this works fine, but its outputting it in a format I don’t desire.
It’s currently displayed as:
Posted on: 2012-11-03 16:17:29
Id prefer it to be something like
Posted on: 3rd November 2012 at 16:15
Is this easily done?
Use the MySQL function
DATE_FORMAT()when you select the date out of your database.Example: