function TimeSpan::getDurationAsIso8601Abnf

Returns the duration as an ISO 8601 ABNF string.

Attributes

#[JsonSchema(['type' => 'string', 'format' => 'duration'])]

Return value

string ABNF-formatted duration.

Overrides DurationInterface::getDurationAsIso8601Abnf

1 call to TimeSpan::getDurationAsIso8601Abnf()
TimeSpan::getDuration in core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php
Returns the duration.

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php, line 41

Class

TimeSpan
The time span data type represents durations as number of seconds.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getDurationAsIso8601Abnf() : string {
  return 'PT' . $this->value . 'S';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.