I created a blog site using PHP 5. When a user saves a blog, the date and time of submission is saved to a field in a database, using the NOW() function (using the format 2007-02-25 18:07:42).
Later, I would like to display a list of all the blogs saved to the database, listing the most recently saved blog first.
Displaying a list of the blogs is no problem. I display the list like this:
foreach($blog_array AS $key)
{
echo "key[0];
}
But how do I sort the entries by date, listing the most recent date
first?
Also, I'd like to be able to display the date in a different format that the one stored in the database. I'd like to be able to display the date as "February 28, 2007, 7:48 AM", or something like that. How can I do this?
2007-02-28
01:57:40
·
3 answers
·
asked by
Anonymous