class DateIntervalToStringTransformer implements DataTransformerInterface
Transforms between a date string and a DateInterval object.
| __construct(string $format = 'P%yY%mM%dDT%hH%iM%sS') Transforms a \DateInterval instance to a string. | ||
| mixed | transform(mixed $value) Transforms a DateInterval object into a date string with the configured format. | |
| mixed | reverseTransform(mixed $value) Transforms a date string in the configured format into a DateInterval object. |
Transforms a \DateInterval instance to a string.
| string | $format | The date format |
| \DateInterval::format() | for supported formats |
Transforms a DateInterval object into a date string with the configured format.
| mixed | $value | The value in the original representation |
| mixed | The value in the transformed representation |
| UnexpectedTypeException | if the given value is not a \DateInterval instance |
Transforms a date string in the configured format into a DateInterval object.
| mixed | $value | The value in the transformed representation |
| mixed | The value in the original representation |
| UnexpectedTypeException | if the given value is not a string |
| TransformationFailedException | if the date interval could not be parsed |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.html