DateTimeToTimestampTransformer
extends BaseDateTimeTransformer
in package
Transforms between a timestamp and a DateTime object.
Tags
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]
$inputTimezone
protected
mixed
$inputTimezone
$outputTimezone
protected
mixed
$outputTimezone
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
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
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
Return values
int|null —A timestamp