public function DurationService::getSecondsFromDurationString in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 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\ServiceCode
public function getSecondsFromDurationString($durationString) {
$date_interval = $this
->getDateIntervalFromDurationString($durationString);
return date_create('@0')
->add($date_interval)
->getTimestamp();
}