mediatekformation

DateTimeToTimestampTransformer extends BaseDateTimeTransformer
in package

Transforms between a timestamp and a DateTime object.

Tags
author

Bernhard Schussek bschussek@gmail.com

author

Florian Eckerstorfer florian@eckerstorfer.org

Table of Contents

$formats  : mixed
$inputTimezone  : mixed
$outputTimezone  : mixed
__construct()  : mixed
reverseTransform()  : DateTime|null
Transforms a timestamp in the configured timezone into a DateTime object.
transform()  : int|null
Transforms a DateTime object into a timestamp in the configured timezone.

Properties

$formats

protected static mixed $formats = [\IntlDateFormatter::NONE, \IntlDateFormatter::FULL, \IntlDateFormatter::LONG, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT]

Methods

__construct()

public __construct([string|null $inputTimezone = null ][, string|null $outputTimezone = null ]) : mixed
Parameters
$inputTimezone : string|null = null

The name of the input timezone

$outputTimezone : string|null = null

The name of the output timezone

Tags
throws
InvalidArgumentException

if a timezone is not valid

Return values
mixed

reverseTransform()

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

public reverseTransform(string $value) : DateTime|null
Parameters
$value : string

A timestamp

Tags
throws
TransformationFailedException

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

Return values
DateTime|null

A \DateTime object

transform()

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

public transform(DateTimeInterface $dateTime) : int|null
Parameters
$dateTime : DateTimeInterface

A DateTimeInterface object

Tags
throws
TransformationFailedException

If the given value is not a \DateTimeInterface

Return values
int|null

A timestamp

Search results