class FullTransformer
Parser and formatter for date formats.
__construct(string $pattern, string $timezone) | ||
Transformer[] | getTransformers() Return the array of Transformer objects. | |
string | format(DateTime $dateTime) Format a DateTime using ICU dateformat pattern. | |
string | formatReplace(string $dateChars, DateTime $dateTime) Return the formatted ICU value for the matched date characters. | |
int|false | parse(DateTime $dateTime, string $value) Parse a pattern based string to a timestamp value. | |
string | getReverseMatchingRegExp(string $pattern) Retrieve a regular expression to match with a formatted value. | |
bool | isQuoteMatch(string $quoteMatch) Check if the first char of a string is a single quote. | |
string | replaceQuoteMatch(string $quoteMatch) Replaces single quotes at the start or end of a string with two single quotes. | |
string | buildCharsMatch(string $specialChars) Builds a chars match regular expression. | |
array | normalizeArray(array $data) Normalize a preg_replace match array, removing the numeric keys and returning an associative array with the value and pattern values for the matched Transformer. | |
bool|int | calculateUnixTimestamp(DateTime $dateTime, array $options) Calculates the Unix timestamp based on the matched values by the reverse matching regular expression of parse(). |
string | $pattern | The pattern to be used to format and/or parse values |
string | $timezone | The timezone to perform the date/time calculations |
Return the array of Transformer objects.
Transformer[] | Associative array of Transformer objects (format char => Transformer) |
Format a DateTime using ICU dateformat pattern.
DateTime | $dateTime | A DateTime object to be used to generate the formatted value |
string | The formatted value |
Return the formatted ICU value for the matched date characters.
string | $dateChars | The date characters to be replaced with a formatted ICU value |
DateTime | $dateTime | A DateTime object to be used to generate the formatted value |
string | The formatted value |
NotImplementedException | When it encounters a not implemented date character |
Parse a pattern based string to a timestamp value.
DateTime | $dateTime | A configured DateTime object to use to perform the date calculation |
string | $value | String to convert to a time value |
int|false | The corresponding Unix timestamp |
InvalidArgumentException | When the value can not be matched with pattern |
Retrieve a regular expression to match with a formatted value.
string | $pattern | The pattern to create the reverse matching regular expression |
string | The reverse matching regular expression with named captures being formed by the transformer index in the $transformer array |
Check if the first char of a string is a single quote.
string | $quoteMatch | The string to check |
bool | true if matches, false otherwise |
Replaces single quotes at the start or end of a string with two single quotes.
string | $quoteMatch | The string to replace the quotes |
string | A string with the single quotes replaced |
Builds a chars match regular expression.
string | $specialChars | A string of chars to build the regular expression |
string | The chars match regular expression |
Normalize a preg_replace match array, removing the numeric keys and returning an associative array with the value and pattern values for the matched Transformer.
array | $data |
array |
Calculates the Unix timestamp based on the matched values by the reverse matching regular expression of parse().
DateTime | $dateTime | The DateTime object to be used to calculate the timestamp |
array | $options | An array with the matched values to be used to calculate the timestamp |
bool|int | The calculated timestamp or false if matched date is invalid |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.html