1 date_sql_handler.inc | date_sql_handler::sql_where_extract($part, $field, $operator, $value, $adjustment = NULL) |
Creates a where clause comparing an extracted date part to an integer.
Parameters
string $part: The part to extract, YEAR, MONTH, DAY, etc.
string $field: The db table and field name, like "$table.$field".
string $operator: The db comparison operator to use, like '=' .
int $value: The integer value to compare the extracted date part to.
Return value
string: SQL for the where clause for this operation.
File
- core/
modules/ date/ views/ date_sql_handler.inc, line 375 - SQL helper for Date API.
Class
- date_sql_handler
- A class to manipulate date SQL.
Code
function sql_where_extract($part, $field, $operator, $value, $adjustment = NULL) {
if (empty($adjustment) && $this->local_timezone != $this->db_timezone) {
$field = $this->sql_field($field);
}
else {
$field = $this->sql_field($field, $adjustment);
}
return $this->sql_extract($part, $field) . " $operator $value";
}