joomla/joomla-platform — pull request #758 by gpongelli (2012-01-17 16:34:13+00:00)
Title: Added JDatabaseQuery::getPartOfDate().

This function is used to extract part of date from timestamp in a database independent manner.
Added MySQL test of element string conversion.

Usage:
$query->getPartOfDate($query->quoteName('dateColumn'), 'day')
for MySQL will return "DAY( dateColumn )"

$query->getPartOfDate($query->quoteName('dateColumn'), 'month')
for MySQL will return "MONTH( dateColumn )"

$query->getPartOfDate($query->quoteName('dateColumn'), 'year')
for MySQL will return "YEAR( dateColumn )"