W3cubDocs

/Symfony 4.1

DateTimeImmutableToDateTimeTransformer

class DateTimeImmutableToDateTimeTransformer implements DataTransformerInterface

Transforms between a DateTimeImmutable object and a DateTime object.

Methods

mixed transform(mixed $value)

Transforms a DateTimeImmutable into a DateTime object.

mixed reverseTransform(mixed $value)

Transforms a DateTime object into a DateTimeImmutable object.

Details

mixed transform(mixed $value)

Transforms a DateTimeImmutable into a DateTime object.

Parameters

mixed $value The value in the original representation

Return Value

mixed The value in the transformed representation

Exceptions

TransformationFailedException If the given value is not a \DateTimeImmutable

mixed reverseTransform(mixed $value)

Transforms a DateTime object into a DateTimeImmutable object.

Parameters

mixed $value The value in the transformed representation

Return Value

mixed The value in the original representation

Exceptions

TransformationFailedException If the given value is not a \DateTime