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
public
__construct( ICanBoogie\CLDR\Calendar $calendar )
Initializes the ICanBoogie\CLDR\DateTimeFormatter::$calendar property.
public
__invoke( mixed $datetime, string $pattern_or_width_or_skeleton )
: string
Alias to the ICanBoogie\CLDR\DateTimeFormatter::format() method.
public
format( DateTimeInterface|string|integer $datetime, string $pattern_or_width_or_skeleton )
: string
Formats a date according to a pattern.
Constants summary
Properties summary
protected static
$formatters
: array
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'
]