tags:

views:

35

answers:

2

I have a query that is grabbing the Date of a given post. I'm displaying this information in a chart that has the date and number of posts for that day. How can I display "Friday, Oct 15" instead of 2010-10-15??

Query:

$oct_week = mysql_query("SELECT COUNT(*), DATE(`dPostDateTime`) AS `day` FROM `tblQA` WHERE dPostDateTime >= '2010-10-01' AND dPostDateTime <= '2010-10-31' GROUP BY `day`");
A: 

Following links demonstrate how to format dates in php:

http://php.net/manual/en/datetime.format.php (concept of date formatting)

http://php.about.com/od/learnphp/ss/php_functions_3.htm (different formats)

Mahesh Velaga
+2  A: 
DATE_FORMAT(DATE(`dPostDateTime`), '%W, %b, %e')
tandu
worked like a charm. THANKS!
BigMike
date_format() can take a datetime value directly, no need for the date() function in there.
Marc B
correct, but he had already wrapped it with DATE() so I wasn't sure what the column was. Just being consistent.
tandu