class 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}
Constants
NONE | |
FULL | |
LONG | |
MEDIUM | |
SHORT | |
TRADITIONAL | |
GREGORIAN |
Methods
__construct(string $locale, int $datetype, int $timetype, mixed $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null) Constructor. | ||
static IntlDateFormatter | create(string $locale, int $datetype, int $timetype, string $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null) Static constructor. | |
string|bool | format(int|DateTime $timestamp) Format the date/time value (timestamp) as a string. | |
string | formatObject(object $object, mixed $format = null, string $locale = null) Not supported. Formats an object. | |
int | getCalendar() Returns the formatter's calendar. | |
object | getCalendarObject() Not supported. Returns the formatter's calendar object. | |
int | getDateType() Returns the formatter's datetype. | |
int | getErrorCode() Returns formatter's last error code. Always returns the UZEROERROR class constant value. | |
string | getErrorMessage() Returns formatter's last error message. Always returns the UZEROERROR_MESSAGE class constant value. | |
string | getLocale(int $type = Locale::ACTUAL_LOCALE) Returns the formatter's locale. | |
string | getPattern() Returns the formatter's pattern. | |
string | getTimeType() Returns the formatter's time type. | |
string | getTimeZoneId() Returns the formatter's timezone identifier. | |
mixed | getTimeZone() Not supported. Returns the formatter's timezone. | |
bool | isLenient() Returns whether the formatter is lenient. | |
string | localtime(string $value, int $position) Not supported. Parse string to a field-based time value. | |
string | parse(string $value, int $position = null) Parse string to a timestamp value. | |
bool | setCalendar(string $calendar) Not supported. Set the formatter's calendar. | |
bool | setLenient(bool $lenient) Set the leniency of the parser. | |
bool | setPattern(string $pattern) Set the formatter's pattern. | |
bool | setTimeZoneId(string $timeZoneId) Set the formatter's timezone identifier. | |
bool | setTimeZone(mixed $timeZone) This method was added in PHP 5.5 as replacement for |
Details
__construct(string $locale, int $datetype, int $timetype, mixed $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null)
Constructor.
static IntlDateFormatter create(string $locale, int $datetype, int $timetype, string $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null)
Static constructor.
string|bool format(int|DateTime $timestamp)
Format the date/time value (timestamp) as a string.
string formatObject(object $object, mixed $format = null, string $locale = null)
Not supported. Formats an object.
int getCalendar()
Returns the formatter's calendar.
object getCalendarObject()
Not supported. Returns the formatter's calendar object.
int getDateType()
Returns the formatter's datetype.
int getErrorCode()
Returns formatter's last error code. Always returns the UZEROERROR class constant value.
string getErrorMessage()
Returns formatter's last error message. Always returns the UZEROERROR_MESSAGE class constant value.
string getLocale(int $type = Locale::ACTUAL_LOCALE)
Returns the formatter's locale.
string getPattern()
Returns the formatter's pattern.
string getTimeType()
Returns the formatter's time type.
string getTimeZoneId()
Returns the formatter's timezone identifier.
mixed getTimeZone()
Not supported. Returns the formatter's timezone.
bool isLenient()
Returns whether the formatter is lenient.
string localtime(string $value, int $position)
Not supported. Parse string to a field-based time value.
string parse(string $value, int $position = null)
Parse string to a timestamp value.
bool setCalendar(string $calendar)
Not supported. Set the formatter's calendar.
bool setLenient(bool $lenient)
Set the leniency of the parser.
Define if the parser is strict or lenient in interpreting inputs that do not match the pattern exactly. Enabling lenient parsing allows the parser to accept otherwise flawed date or time patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or invalid values ("February 30th") are not accepted.
bool setPattern(string $pattern)
Set the formatter's pattern.
bool setTimeZoneId(string $timeZoneId)
Set the formatter's timezone identifier.
bool setTimeZone(mixed $timeZone)
This method was added in PHP 5.5 as replacement for setTimeZoneId()
.
Please login to continue.