mediatekformation

DateTimeToArrayTransformer extends BaseDateTimeTransformer
in package

Transforms between a normalized time and a localized time string/array.

Tags
author

Bernhard Schussek bschussek@gmail.com

author

Florian Eckerstorfer florian@eckerstorfer.org

Table of Contents

$formats  : mixed
$inputTimezone  : mixed
$outputTimezone  : mixed
$fields  : mixed
$pad  : mixed
$referenceDate  : mixed
__construct()  : mixed
reverseTransform()  : DateTime|null
Transforms a localized date into a normalized date.
transform()  : array<string|int, mixed>
Transforms a normalized date into a localized date.

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 ][, array<string|int, string>|null $fields = null ][, bool $pad = false ][, DateTimeInterface $referenceDate = null ]) : mixed
Parameters
$inputTimezone : string|null = null

The input timezone

$outputTimezone : string|null = null

The output timezone

$fields : array<string|int, string>|null = null

The date fields

$pad : bool = false

Whether to use padding

$referenceDate : DateTimeInterface = null
Return values
mixed

reverseTransform()

Transforms a localized date into a normalized date.

public reverseTransform(array<string|int, mixed> $value) : DateTime|null
Parameters
$value : array<string|int, mixed>

Localized date

Tags
throws
TransformationFailedException

If the given value is not an array, if the value could not be transformed

Return values
DateTime|null

Normalized date

transform()

Transforms a normalized date into a localized date.

public transform(DateTimeInterface $dateTime) : array<string|int, mixed>
Parameters
$dateTime : DateTimeInterface

A DateTimeInterface object

Tags
throws
TransformationFailedException

If the given value is not a \DateTimeInterface

Return values
array<string|int, mixed>

Localized date

Search results