[thelist] mySQL DATE_FORMAT question

Tom Dell'Aringa pixelmech at yahoo.com
Tue Jul 29 11:42:25 CDT 2003


hello,

I'm trying to format my date using the DATE_FORMAT function of mySQL.
Here is my query:

SELECT  
  articleTitle, 
  articleID, 
  articleBlurb, 
    DATE_FORMAT('dateCreated', '%b %D %Y')
FROM 
  article 
LIMIT 3

'dateCreated' in my date field in the article table. I tried with and
without quotes, both times getting the "Undefined index: dateCreated"
error. All the docs say is:

DATE_FORMAT(date,format) 

So I'm not sure what I am doing wrong. Would I be better off doing
this in PHP instead?

Also, related question - instead of LIMIT 3, I'd like to get the 3
LATEST articles. I know that the first 3 won't necessarily be that.
How can I select the latest 3 by date?

TIA

Tom

=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward


More information about the thelist mailing list