IntlDatePatternGenerator

Generates localized date and/or time format pattern strings suitable for use in IntlDateFormatter

Transforms unordered skeleton formats like "MMddyyyy" to use the correct ordering and separators for the locale (for example, one locale might use "dd-MM-yyyy" when another uses "yyyy/MM/dd").

See Unicode UTS #35 appendix F (Date Format Patterns) for valid input format patterns: http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns

Example usage: $locale = 'en_US'; $generator = IntlDatePatternGenerator::createInstance($locale); $pattern = $generator->getBestPattern('MMddyyyy'); $formatter = IntlDateFormatter::create($locale, null, null); $formatter->setPattern($pattern); $date = $formatter->format(new DateTime());

Constants:

Pattern fields: IntlDatePatternGenerator::ERA_PATTERN_FIELD IntlDatePatternGenerator::YEAR_PATTERN_FIELD IntlDatePatternGenerator::QUARTER_PATTERN_FIELD IntlDatePatternGenerator::MONTH_PATTERN_FIELD IntlDatePatternGenerator::WEEK_OF_YEAR_PATTERN_FIELD IntlDatePatternGenerator::WEEK_OF_MONTH_PATTERN_FIELD IntlDatePatternGenerator::WEEKDAY_PATTERN_FIELD IntlDatePatternGenerator::DAY_OF_YEAR_PATTERN_FIELD IntlDatePatternGenerator::DAY_OF_WEEK_IN_MONTH_PATTERN_FIELD IntlDatePatternGenerator::DAY_PATTERN_FIELD IntlDatePatternGenerator::DAYPERIOD_PATTERN_FIELD IntlDatePatternGenerator::HOUR_PATTERN_FIELD IntlDatePatternGenerator::MINUTE_PATTERN_FIELD IntlDatePatternGenerator::SECOND_PATTERN_FIELD IntlDatePatternGenerator::FRACTIONAL_SECOND_PATTERN_FIELD IntlDatePatternGenerator::ZONE_PATTERN_FIELD

Pattern conflict status: IntlDatePatternGenerator::PATTERN_NO_CONFLICT IntlDatePatternGenerator::PATTERN_BASE_CONFLICT IntlDatePatternGenerator::PATTERN_CONFLICT

Interface Synopsis

class IntlDatePatternGenerator {...}

Public Methods