You are here

public function DurationService::getSecondsFromDurationString in Duration Field 8.2

Same name and namespace in other branches
  1. 3.0.x src/Service/DurationService.php \Drupal\duration_field\Service\DurationService::getSecondsFromDurationString()

Get the number of seconds an ISO 8601 duration string represents.

Parameters

string $durationString: The ISO 8601 duration string.

Return value

int The number of seconds the duration string represents.

Overrides DurationServiceInterface::getSecondsFromDurationString

File

src/Service/DurationService.php, line 162

Class

DurationService
Provides services for the Duration Field module.

Namespace

Drupal\duration_field\Service

Code

public function getSecondsFromDurationString($durationString) {
  $date_interval = $this
    ->getDateIntervalFromDurationString($durationString);
  return date_create('@0')
    ->add($date_interval)
    ->getTimestamp();
}