public function DurationServiceInterface::getHumanReadableStringFromDateInterval in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 src/Service/DurationServiceInterface.php \Drupal\duration_field\Service\DurationServiceInterface::getHumanReadableStringFromDateInterval()
Get a human-readable string representing a DateTime interval.
Parameters
\DateInterval $dateInterval: The PHP DateInterval for which a human-readable value should be extracted.
array $granularity: An array containing the following keys:
- y (year)
- m (month)
- d (day)
- h (hour)
- i (minute)
- s (second)
Each key should be set to TRUE or FALSE to indicate whether or not the value should be displayed.
string $separator: The separator that should be inserted between each time element value of the interval.
string $textLength: The length of text that should be returned. Allowed values are 'full' and 'short'.
Return value
string A human readable translated string representing the DateInterval element.
1 method overrides DurationServiceInterface::getHumanReadableStringFromDateInterval()
- DurationService::getHumanReadableStringFromDateInterval in src/
Service/ DurationService.php - Get a human-readable string representing a DateTime interval.
File
- src/
Service/ DurationServiceInterface.php, line 116
Class
- DurationServiceInterface
- Interface for classes providing services for the Duration Field module.
Namespace
Drupal\duration_field\ServiceCode
public function getHumanReadableStringFromDateInterval(DateInterval $dateInterval, array $granularity, $separator = ' ', $textLength = 'full');