View Single Post
Old 04-01-2006, 08:53 AM   #1 (permalink)
bayruni
Registered User
 
Join Date: Mar 2006
Posts: 9
bayruni is on a distinguished road
Question Problems in date DESC after changing format

My php application used to display the date as YEAR-MM-DD HH:MM:SS. Not pretty. So, I made it display it in a more friendly way like April 01, 2006, 03:30:29 PM.

I thought everything was great and was getting ready to celebrate, only I noticed that when I added new articles that date was not arranged correctly. If articles were posted in March, they would all be arranged in DESC order. And articles posted in February would appear under those in March. No problem, so far, except that articles posted on April would be listed way at the bottom.

I'm guessing something in my code is making it arrange the articles by date in alphabetical order as well. March > Feb > April...

Here is my query:
PHP Code:
$query_rsArticles "SELECT *, DATE_FORMAT(article_date, '%M %d, %Y, %r') AS article_date FROM np_articles INNER JOIN np_categories ON article_category_id=category_id ORDER BY article_date DESC"
And this bit displays the date under the article:
PHP Code:
<?php echo $row_rsArticles['article_date']; ?>
The date appears fine, just like I want it to be, BUT it is arranged in alphabetical order (months) and I don't want that to happen.

Suggestions, anyone?
bayruni is offline   Reply With Quote