Class DateTimeFormatter
Provides date and time localization.
The class allows you to format dates and times in a locale-sensitive manner using Unicode format patterns.
- ICanBoogie\CLDR\DateTimeFormatter implements ICanBoogie\CLDR\Formatter uses ICanBoogie\Accessor\AccessorTrait (not available)
Direct known subclasses
ICanBoogie\CLDR\DateFormatter
,
ICanBoogie\CLDR\TimeFormatter
Methods summary
protected static
array
|
|
protected
|
|
public
|
#
__construct(
Initializes the |
public
string
|
#
__invoke( mixed $datetime, string $pattern_or_width_or_skeleton )
Alias to the |
public
string
|
|
protected
string
|
#
resolve_pattern( string $pattern_or_width_or_skeleton )
Resolves the specified pattern, which can be a width, a skeleton or an actual pattern. |
protected
string
|
#
resolve_width( string $pattern_or_width_or_skeleton, string $from )
Resolves widths (full, long, medium, short) into a pattern. |
protected
string
|
#
format_era(
Era - Replaced with the Era string for the current date. One to three letters for the abbreviated form, four letters for the long form, five for the narrow form. [1..3,4,5] |
protected
string
|
#
format_year(
Year. Normally the length specifies the padding, but for two letters it also specifies the maximum length. [1..n] |
protected
string
|
#
format_standalone_quarter(
Stand-Alone Quarter - Use one or two "q" for the numerical quarter, three for the abbreviation, or four for the full (wide) name. [1..2,3,4] |
protected
string
|
#
format_standalone_month(
Stand-Alone Month - Use one or two "L" for the numerical month, three for the abbreviation, or four for the full (wide) name, or 5 for the narrow name. [1..2,3,4,5] |
protected
string
|
#
format_week_of_year(
Week of Year. [1..2] |
protected
integer|false
|
#
format_week_of_month(
Week of Month. [1] |
protected
string
|
#
format_day_of_month(
Date - Day of the month. [1..2] |
protected
string
|
#
format_day_of_year(
Day of year. [1..3] |
protected
string
|
#
format_day_of_week_in_month(
Day of Week in Month. The example is for the 2nd Wed in July. [1] |
protected
string
|
#
format_day_in_week(
Day of week - Use one through three letters for the short day, or four for the full name, five for the narrow name, or six for the short name. [1..3,4,5,6] |
protected
string
|
#
format_day_in_week_stand_alone(
Stand-Alone local day of week - Use one letter for the local numeric value (same as 'e'), three for the abbreviated day name, four for the full (wide) name, five for the narrow name, or six for the short name. |
protected
string
|
#
format_day_in_week_local(
Local day of week. Same as E except adds a numeric value that will depend on the local starting day of the week, using one or two letters. For this example, Monday is the first day of the week. |
protected
string
|
|
protected
string
|
#
format_hour12(
Hour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match a 24-hour-cycle format (H or k). Use hh for zero padding. [1..2] |
protected
string
|
#
format_hour24(
Hour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a 12-hour-cycle format (h or K). Use HH for zero padding. [1..2] |
protected
integer
|
#
format_hour_in_period(
Hour [0-11]. When used in a skeleton, only matches K or h, see above. Use KK for zero padding. [1..2] |
protected
integer
|
#
format_hour_in_day(
Hour [1-24]. When used in a skeleton, only matches k or H, see above. Use kk for zero padding. [1..2] |
protected
string
|
#
format_minutes(
Minute. Use one or two "m" for zero padding. |
protected
string
|
#
format_seconds(
Second. Use one or two "s" for zero padding. |
protected
string
|
|
protected
string
|
#
format_timezone_non_location(
The specific non-location format. |
Constants summary
string |
WIDTH_FULL
|
#
'full'
|
string |
WIDTH_LONG
|
#
'long'
|
string |
WIDTH_MEDIUM
|
#
'medium'
|
string |
WIDTH_SHORT
|
#
'short'
|
Properties summary
protected static
array
|
$formatters
Pattern characters mapping to the corresponding translator methods. |
#
[
'G' => 'format_era',
'y' => 'format_year',
// 'Y' => Year (in "Week of Year" based calendars).
// 'u' => Extended year.
'Q' => 'format_quarter',
'q' => 'format_standalone_quarter',
'M' => 'format_month',
'L' => 'format_standalone_month',
// 'l' => Special symbol for Chinese leap month, used in combination with M. Only used with the Chinese calendar.
'w' => 'format_week_of_year',
'W' => 'format_week_of_month',
'd' => 'format_day_of_month',
'D' => 'format_day_of_year',
'F' => 'format_day_of_week_in_month',
'h' => 'format_hour12',
'H' => 'format_hour24',
'm' => 'format_minutes',
's' => 'format_seconds',
'E' => 'format_day_in_week',
'c' => 'format_day_in_week_stand_alone',
'e' => 'format_day_in_week_local',
'a' => 'format_period',
'k' => 'format_hour_in_day',
'K' => 'format_hour_in_period',
'z' => 'format_timezone_non_location',
'Z' => 'format_timezone_basic',
'v' => 'format_timezone_non_location'
]
|
protected
|
$calendar
The calendar used to format the datetime. |
Magic properties
public read-only
|
$calendar
The calendar used by the formatter. |