On this page
DateTimeToRfc3339Transformer
class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
Methods
__construct(string $inputTimezone = null, string $outputTimezone = null) Constructor. |
from BaseDateTimeTransformer | |
mixed | transform(DateTimeInterface $dateTime) Transforms a normalized date into a localized date. |
|
mixed | reverseTransform(string $rfc3339) Transforms a formatted string following RFC 3339 into a normalized date. |
Details
__construct(string $inputTimezone = null, string $outputTimezone = null)
Constructor.
Parameters
string | $inputTimezone | The name of the input timezone |
string | $outputTimezone | The name of the output timezone |
Exceptions
UnexpectedTypeException | if a timezone is not a string |
InvalidArgumentException | if a timezone is not valid |
mixed transform(DateTimeInterface $dateTime)
Transforms a normalized date into a localized date.
Parameters
DateTimeInterface | $dateTime | A DateTimeInterface object |
Return Value
mixed | The value in the transformed representation |
Exceptions
TransformationFailedException | If the given value is not a \DateTimeInterface |
mixed reverseTransform(string $rfc3339)
Transforms a formatted string following RFC 3339 into a normalized date.
Parameters
string | $rfc3339 | Formatted string |
Return Value
mixed | The value in the original representation |
Exceptions
TransformationFailedException | If the given value is not a string, if the value could not be transformed |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.1/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.html