ionutb - tech & more
Thursday, May 19, 2011
PHP, MySQL: Obtain all days for year-month pair
Get all dates / days for a given year and month (from a table containing articles for example).
SELECT DISTINCT DAY(datec) `day`
FROM table_name
WHERE DATE_FORMAT(datec, '%Y-%m') = '$year-$month'
MySQL DATE_FORMAT() - Description from Manual
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment