Jump to content

DATETIME


OAFC_Rob

Recommended Posts

I have a news article table with a field set to "DATETIME", when I'm running the SQL i'm formatting the using SQL rather than PHP and then ordering by the date / time. However, I noticed yesterday that it was only sorting via the date and not the date and then the time.

 

 

Should I swap it to a date and timestamp, as in two seperate fields.

 

SELECT
         tbl_news_id, 
         headline,
         article,
         DATE_FORMAT(datePublished, '%D %M %Y @ %H:%i' ) AS datePublished, 
         rssFeed
FROM
         tbl_news
ORDER BY 
         datePublished 
ASC LIMIT 2

Link to comment
https://forums.phpfreaks.com/topic/246523-datetime/
Share on other sites

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.