I have a blog that I'm trying to customize, and I'm trying to extract the month from each entry date. The entry date format looks like this:
Which (using the php date function) translates to Tuesday, August 17, 2010.
But I need the month at the query level, because I want to group older posts by month. I've tried doing this:
, month(entry_date) as postmonth
WHERE entry_author_id = 1
AND entry_status = 'published'
ORDER BY entry_date DESC
LIMIT 5, 15
But I get a blank. Not sure why php can pull a date from that string but the month() function can't. I also tried monthname() with the same (lack of) results.
What am I doing wrong?
That did it! I ended up using the second option, with the %M flag.
you're using a date function on an integer -- you have to convert the integer to a date first, and then there are 2 ways of extracting the month