class DateTimeToTimestampTransformer extends BaseDateTimeTransformer

Transforms between a timestamp and a DateTime object.

Properties

static protected $formats from BaseDateTimeTransformer
protected $inputTimezone from BaseDateTimeTransformer
protected $outputTimezone from BaseDateTimeTransformer

Methods

__construct(string $inputTimezone = null, string $outputTimezone = null)

No description

mixed
transform(DateTimeInterface $dateTime)

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

mixed
reverseTransform(mixed $value)

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

Details

__construct(string $inputTimezone = null, string $outputTimezone = null)

Parameters

string $inputTimezone The name of the input timezone
string $outputTimezone The name of the output timezone

Exceptions

InvalidArgumentException if a timezone is not valid

at line 33
mixed transform(DateTimeInterface $dateTime)

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

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

at line 56
mixed reverseTransform(mixed $value)

Transforms a timestamp in the configured timezone into a DateTime 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 timestamp or if the given timestamp is invalid