You are here

function date_sql_handler::sql_where_format in Date 6.2

Same name and namespace in other branches
  1. 5.2 date_api_sql.inc \date_sql_handler::sql_where_format()
  2. 6 date_api_sql.inc \date_sql_handler::sql_where_format()
  3. 7.3 date_api/date_api_sql.inc \date_sql_handler::sql_where_format()
  4. 7 date_api/date_api_sql.inc \date_sql_handler::sql_where_format()
  5. 7.2 date_api/date_api_sql.inc \date_sql_handler::sql_where_format()

Create a where clause to compare a formated field to a formated value.

Parameters

string $format: The format to use on the date and the value when comparing them.

string $field: The db table and field name, like "$table.$field".

string $operator: The db comparison operator to use, like '='.

string $value: The value to compare the extracted date part to, could be a field name or a date string or NOW().

Return value

SQL for the where clause for this operation.

File

./date_api_sql.inc, line 496
SQL date functions.

Class

date_sql_handler
A class to manipulate date SQL.

Code

function sql_where_format($format, $field, $operator, $value, $adjustment = NULL) {
  $field = $this
    ->sql_field($field, $adjustment);
  return $this
    ->sql_format($format, $field) . " {$operator} '{$value}'";
}