Symfony\Component\Intl\DateFormatter\IntlDateFormatter
Replacement for PHP's native {@link \IntlDateFormatter} class.
The only methods currently supported in this class are:
- {@link __construct}
- {@link create}
- {@link format}
- {@link getCalendar}
- {@link getDateType}
- {@link getErrorCode}
- {@link getErrorMessage}
- {@link getLocale}
- {@link getPattern}
- {@link getTimeType}
- {@link getTimeZoneId}
- {@link isLenient}
- {@link parse}
- {@link setLenient}
- {@link setPattern}
- {@link setTimeZoneId}
- {@link setTimeZone}
- Author: Igor Wiedler <igor@wiedler.ch>
Synopsis
class IntlDateFormatter
{
- // constants
- const NONE = 1;
- const FULL = 0;
- const LONG = 1;
- const MEDIUM = 2;
- const SHORT = 3;
- const TRADITIONAL = 0;
- const GREGORIAN = 1;
- // members
- protected integer $errorCode;
- protected string $errorMessage;
- private array $defaultDateFormats;
- private array $defaultTimeFormats;
- private int $datetype;
- private int $timetype;
- private string $pattern;
- private DateTimeZone $dateTimeZone;
- private Boolean $unitializedTimeZoneId;
- private string $timeZoneId;
- // methods
- public void __construct()
- public static IntlDateFormatter create()
- public string|Boolean format()
- public string formatObject()
- public int getCalendar()
- public getCalendarObject()
- public int getDateType()
- public int getErrorCode()
- public string getErrorMessage()
- public string getLocale()
- public string getPattern()
- public string getTimeType()
- public string getTimeZoneId()
- public mixed getTimeZone()
- public Boolean isLenient()
- public string localtime()
- public string parse()
- public Boolean setCalendar()
- public Boolean setLenient()
- public Boolean setPattern()
- public Boolean setTimeZoneId()
- public Boolean setTimeZone()
- protected DateTime createDateTime()
- protected string getDefaultPattern()
Hierarchy
Constants
Name | Value |
---|---|
NONE | 1 |
FULL | 0 |
LONG | 1 |
MEDIUM | 2 |
SHORT | 3 |
TRADITIONAL | 0 |
GREGORIAN | 1 |
Members
private
- $dateTimeZone — \DateTimeZone
- $datetype — int
- $defaultDateFormats
—
array
Patterns used to format the date when no pattern is provided - $defaultTimeFormats
—
array
Patterns used to format the time when no pattern is provided - $pattern — string
- $timeZoneId — string
- $timetype — int
- $unitializedTimeZoneId — Symfony\Component\Intl\DateFormatter\Boolean
protected
- $errorCode
—
integer
The error code from the last operation - $errorMessage
—
string
The error message from the last operation
Methods
protected
- createDateTime() — Create and returns a DateTime object with the specified timestamp and with the current time zone
- getDefaultPattern() — Returns a pattern string based in the datetype and timetype values
public
- __construct() — Constructor
- create() — Static constructor
- format() — Format the date/time value (timestamp) as a string
- formatObject() — Not supported. Formats an object
- getCalendar() — Returns the formatter's calendar
- getCalendarObject() — Not supported. Returns the formatter's calendar object
- getDateType() — Returns the formatter's datetype
- getErrorCode() — Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value
- getErrorMessage() — Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value
- getLocale() — Returns the formatter's locale
- getPattern() — Returns the formatter's pattern
- getTimeType() — Returns the formatter's time type
- getTimeZone() — Not supported. Returns the formatter's timezone
- getTimeZoneId() — Returns the formatter's timezone identifier
- isLenient() — Returns whether the formatter is lenient
- localtime() — Not supported. Parse string to a field-based time value
- parse() — Parse string to a timestamp value
- setCalendar() — Not supported. Set the formatter's calendar
- setLenient() — Set the leniency of the parser
- setPattern() — Set the formatter's pattern
- setTimeZone() — This method was added in PHP 5.5 as replacement for `setTimeZoneId()`
- setTimeZoneId() — Set the formatter's timezone identifier