3 namespace Drupal\views\Plugin\views\query;
6 * Defines an interface for handling date queries with SQL.
9 * Classes implementing this interface should only be used by the Views SQL
12 * @see \Drupal\views\Plugin\views\query\Sql
14 interface DateSqlInterface {
17 * Returns a native database expression for a given field.
19 * @param string $field
20 * The query field that will be used in the expression.
21 * @param bool $string_date
22 * For certain databases, date format functions vary depending on string or
26 * An expression representing a date field with timezone.
28 public function getDateField($field, $string_date);
31 * Creates a native database date formatting.
33 * @param string $field
34 * An appropriate query expression pointing to the date field.
35 * @param string $format
36 * A format string for the result. For example: 'Y-m-d H:i:s'.
39 * A string representing the field formatted as a date as specified by
42 public function getDateFormat($field, $format);
45 * Applies the given offset to the given field.
47 * @param string &$field
48 * The date field in a string format.
50 * The timezone offset in seconds.
52 public function setFieldTimezoneOffset(&$field, $offset);
55 * Set the database to the given timezone.
57 * @param string $offset
60 public function setTimezoneOffset($offset);