DateTimeToLocalizedStringTransformer
class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
Transforms between a normalized time and a localized time string.
Methods
| __construct(string $inputTimezone = null, string $outputTimezone = null, int $dateFormat = null, int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, string $pattern = null) Constructor. | |
mixed | transform(DateTime|DateTimeInterface $dateTime) Transforms a normalized date into a localized date string/array. | |
mixed | reverseTransform(mixed $value) Transforms a localized date string/array into a normalized date. | |
Details
__construct(string $inputTimezone = null, string $outputTimezone = null, int $dateFormat = null, int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, string $pattern = null)
Constructor.
Parameters
string | $inputTimezone | The name of the input timezone |
string | $outputTimezone | The name of the output timezone |
int | $dateFormat | The date format |
int | $timeFormat | The time format |
int | $calendar | One of the \IntlDateFormatter calendar constants |
string | $pattern | A pattern to pass to \IntlDateFormatter |
Exceptions
See also
BaseDateTimeTransformer::formats | for available format options |
Transforms a normalized date into a localized date string/array.
Parameters
Return Value
mixed | The value in the transformed representation |
Exceptions
Transforms a localized date string/array into a normalized date.
Parameters
mixed | $value | The value in the transformed representation |
Return Value
mixed | The value in the original representation |
Exceptions