You are here

protected function DateSorter::convertToUnixTimestamp in Views XML Backend 8

Coverts a value to a UNIX timestamp.

Parameters

string|int $date: The date to convert.

Return value

int The unix timestamp of the date.

1 call to DateSorter::convertToUnixTimestamp()
DateSorter::__invoke in src/Sorter/DateSorter.php
Sorts a views result.

File

src/Sorter/DateSorter.php, line 64
Contains \Drupal\views_xml_backend\Sorter\DateSorter.

Class

DateSorter
Provides sorting for dates.

Namespace

Drupal\views_xml_backend\Sorter

Code

protected function convertToUnixTimestamp($date) {
  if (is_numeric($date)) {
    return (int) $date;
  }
  return strtotime($date);
}