class DateTimeToTimestampTransformer extendsBaseDateTimeTransformer

Transforms between a timestamp and a DateTime object.

Methods

int|null
transform(mixed$dateTime)

Transforms a DateTime object into a timestamp in the configured timezone.

DateTime|null
reverseTransform(mixed$value)

Transforms a timestamp in the configured timezone into a DateTime object.

Details

int|null transform(mixed$dateTime)

Transforms a DateTime object into a timestamp in the configured timezone.

Parameters

mixed $dateTime A DateTimeInterface object

Return Value

int|null

Exceptions

TransformationFailedException If the given value is not a \DateTimeInterface

DateTime|null reverseTransform(mixed$value)

Transforms a timestamp in the configured timezone into a DateTime object.

Parameters

mixed $value A timestamp

Return Value

DateTime|null

Exceptions

TransformationFailedException If the given value is not a timestamp or if the given timestamp is invalid