Formatting datetime objects in MySQL only
This is how format datetime objects directly in a MySQL query:
SELECT * FROM articles WHERE DATE_FORMAT([column_name_with_datetime_object], "%Y") = "2009";
If you want to select the month, use "%m" instead.
Here's an overview of the different possibilities:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
Source: http://dev.mysql.com/doc/