Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DateSqlInterface.php

interface DateSqlInterface

Defines an interface for handling date queries with SQL.

@internal Classes implementing this interface should only be used by the Views SQL query plugin.

Hierarchy

  • interface \Drupal\views\Plugin\views\query\DateSqlInterface

Expanded class hierarchy of DateSqlInterface

All classes that implement DateSqlInterface

See also

\Drupal\views\Plugin\views\query\Sql

File

core/modules/views/src/Plugin/views/query/DateSqlInterface.php, line 14

Namespace

Drupal\views\Plugin\views\query
View source
interface DateSqlInterface {
    
    /**
     * Returns a native database expression for a given field.
     *
     * @param string $field
     *   The query field that will be used in the expression.
     * @param bool $string_date
     *   For certain databases, date format functions vary depending on string or
     *   numeric storage.
     *
     * @return string
     *   An expression representing a date field with timezone.
     */
    public function getDateField($field, $string_date);
    
    /**
     * Creates a native database date formatting.
     *
     * @param string $field
     *   An appropriate query expression pointing to the date field.
     * @param string $format
     *   A format string for the result. For example: 'Y-m-d H:i:s'.
     *
     * @return string
     *   A string representing the field formatted as a date as specified by
     *   $format.
     */
    public function getDateFormat($field, $format);
    
    /**
     * Applies the given offset to the given field.
     *
     * @param string &$field
     *   The date field in a string format.
     * @param int $offset
     *   The timezone offset in seconds.
     */
    public function setFieldTimezoneOffset(&$field, $offset);
    
    /**
     * Set the database to the given timezone.
     *
     * @param string $offset
     *   The timezone.
     */
    public function setTimezoneOffset($offset);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
DateSqlInterface::getDateField public function Returns a native database expression for a given field. 3
DateSqlInterface::getDateFormat public function Creates a native database date formatting. 3
DateSqlInterface::setFieldTimezoneOffset public function Applies the given offset to the given field. 3
DateSqlInterface::setTimezoneOffset public function Set the database to the given timezone. 3

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal