You are here

private function ScheduledPublishCron::getTimestampFromIso8601 in Scheduled Publish 8.2

Same name and namespace in other branches
  1. 8.3 src/Service/ScheduledPublishCron.php \Drupal\scheduled_publish\Service\ScheduledPublishCron::getTimestampFromIso8601()
  2. 8 src/Service/ScheduledPublishCron.php \Drupal\scheduled_publish\Service\ScheduledPublishCron::getTimestampFromIso8601()

Returns timestamp from ISO-8601 datetime

Parameters

string $dateIso8601:

Return value

int

Throws

\Exception

1 call to ScheduledPublishCron::getTimestampFromIso8601()
ScheduledPublishCron::updateEntityField in src/Service/ScheduledPublishCron.php
Update scheduled publish fields

File

src/Service/ScheduledPublishCron.php, line 174

Class

ScheduledPublishCron
Class ScheduledPublishCron

Namespace

Drupal\scheduled_publish\Service

Code

private function getTimestampFromIso8601(string $dateIso8601) : int {
  $datetime = new DateTime($dateIso8601, new DateTimeZone(ScheduledPublish::STORAGE_TIMEZONE));
  $datetime
    ->setTimezone(new \DateTimeZone(drupal_get_user_timezone()));
  return $datetime
    ->getTimestamp();
}