DateTimeToLocalizedStringTransformer
extends BaseDateTimeTransformer
in package
Transforms between a normalized time and a localized time string.
Tags
Table of Contents
- $formats : mixed
- $inputTimezone : mixed
- $outputTimezone : mixed
- $calendar : mixed
- $dateFormat : mixed
- $pattern : mixed
- $timeFormat : mixed
- __construct() : mixed
- reverseTransform() : DateTime|null
- Transforms a localized date string/array into a normalized date.
- transform() : string
- Transforms a normalized date into a localized date string/array.
- getIntlDateFormatter() : IntlDateFormatter
- Returns a preconfigured IntlDateFormatter instance.
- isPatternDateOnly() : bool
- Checks if the pattern contains only a date.
Properties
$formats
protected
static mixed
$formats
= [\IntlDateFormatter::NONE, \IntlDateFormatter::FULL, \IntlDateFormatter::LONG, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT]
$inputTimezone
protected
mixed
$inputTimezone
$outputTimezone
protected
mixed
$outputTimezone
$calendar
private
mixed
$calendar
$dateFormat
private
mixed
$dateFormat
$pattern
private
mixed
$pattern
$timeFormat
private
mixed
$timeFormat
Methods
__construct()
public
__construct([string|null $inputTimezone = null ][, string|null $outputTimezone = null ][, int|null $dateFormat = null ][, int|null $timeFormat = null ][, int $calendar = IntlDateFormatter::GREGORIAN ][, string|null $pattern = null ]) : mixed
Parameters
- $inputTimezone : string|null = null
-
The name of the input timezone
- $outputTimezone : string|null = null
-
The name of the output timezone
- $dateFormat : int|null = null
-
The date format
- $timeFormat : int|null = null
-
The time format
- $calendar : int = IntlDateFormatter::GREGORIAN
-
One of the \IntlDateFormatter calendar constants
- $pattern : string|null = null
-
A pattern to pass to \IntlDateFormatter
Tags
Return values
mixed —reverseTransform()
Transforms a localized date string/array into a normalized date.
public
reverseTransform(string|array<string|int, mixed> $value) : DateTime|null
Parameters
- $value : string|array<string|int, mixed>
-
Localized date string/array
Tags
Return values
DateTime|null —Normalized date
transform()
Transforms a normalized date into a localized date string/array.
public
transform(DateTimeInterface $dateTime) : string
Parameters
- $dateTime : DateTimeInterface
-
A DateTimeInterface object
Tags
Return values
string —Localized date string
getIntlDateFormatter()
Returns a preconfigured IntlDateFormatter instance.
protected
getIntlDateFormatter([bool $ignoreTimezone = false ]) : IntlDateFormatter
Parameters
- $ignoreTimezone : bool = false
-
Use UTC regardless of the configured timezone
Tags
Return values
IntlDateFormatter —isPatternDateOnly()
Checks if the pattern contains only a date.
protected
isPatternDateOnly() : bool