You are here

protected function GetAlerts::dateNow in Site Alert 8

Returns the date in correct timezone and format to compare with database.

Return value

string The date string representing the current time.

1 call to GetAlerts::dateNow()
GetAlerts::getActiveAlertIds in src/GetAlerts.php
Returns the entity IDs of the currently active site alerts.

File

src/GetAlerts.php, line 77

Class

GetAlerts
Service for retrieving site alerts.

Namespace

Drupal\site_alert

Code

protected function dateNow() {
  $now = new DrupalDateTime();
  $now
    ->setTimezone(new DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE));
  return $now
    ->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
}