public function SqliteDateSql::getDateField in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/query/SqliteDateSql.php \Drupal\views\Plugin\views\query\SqliteDateSql::getDateField()
Returns a native database expression for a given field.
Parameters
string $field: The query field that will be used in the expression.
bool $string_date: For certain databases, date format functions vary depending on string or numeric storage.
Return value
string An expression representing a date field with timezone.
Overrides DateSqlInterface::getDateField
File
- core/
modules/ views/ src/ Plugin/ views/ query/ SqliteDateSql.php, line 73
Class
- SqliteDateSql
- SQLite-specific date handling.
Namespace
Drupal\views\Plugin\views\queryCode
public function getDateField($field, $string_date) {
if ($string_date) {
$field = "strftime('%s', {$field})";
}
return $field;
}