class DateTimeToStringTransformer extends BaseDateTimeTransformer
Transforms between a date string and a DateTime object.
__construct(string $inputTimezone = null, string $outputTimezone = null, string $format = 'Y-m-d H:i:s') Transforms a \DateTime instance to a string. | ||
mixed | transform(DateTimeInterface $dateTime) Transforms a DateTime object into a date string with the configured format and timezone. | |
mixed | reverseTransform(mixed $value) Transforms a date string in the configured timezone into a DateTime object. |
Transforms a \DateTime instance to a string.
string | $inputTimezone | The name of the input timezone |
string | $outputTimezone | The name of the output timezone |
string | $format | The date format |
\DateTime::format() | for supported formats |
Transforms a DateTime object into a date string with the configured format and timezone.
DateTimeInterface | $dateTime | A DateTimeInterface object |
mixed | The value in the transformed representation |
TransformationFailedException | If the given value is not a \DateTimeInterface |
Transforms a date string in the configured timezone into a DateTime object.
mixed | $value | The value in the transformed representation |
mixed | The value in the original representation |
TransformationFailedException | If the given value is not a string, or could not be transformed |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.html