IntlDateFormatter
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 |
|
Properties
protected int | $errorCode | The error code from the last operation. | |
protected string | $errorMessage | The error message from the last operation. |
Methods
No description
Static constructor.
Not supported. Formats an object.
Returns the formatter's calendar.
Not supported. Returns the formatter's calendar object.
Returns the formatter's datetype.
Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value.
Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value.
Returns the formatter's locale.
Returns the formatter's pattern.
Returns the formatter's time type.
Returns the formatter's timezone identifier.
Not supported. Returns the formatter's timezone.
Returns whether the formatter is lenient.
Not supported. Parse string to a field-based time value.
Parse string to a timestamp value.
Not supported. Set the formatter's calendar.
Set the leniency of the parser.
Set the formatter's pattern.
Set the formatter's timezone identifier.
This method was added in PHP 5.5 as replacement for setTimeZoneId()
.
Create and returns a DateTime object with the specified timestamp and with the current time zone.
Returns a pattern string based in the datetype and timetype values.
Details
__construct(string|null $locale, int|null $datetype, int|null $timetype, IntlTimeZone|DateTimeZone|string|null $timezone = null, int|null $calendar = self::GREGORIAN, string $pattern = null)
static IntlDateFormatter
create(string $locale, int|null $datetype, int|null $timetype, IntlTimeZone|DateTimeZone|string|null $timezone = null, int $calendar = self::GREGORIAN, string|null $pattern = null)
Static constructor.
string
formatObject(object $object, mixed $format = null, string $locale = null)
Not supported. Formats an object.
int
getErrorCode()
Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value.
string
getErrorMessage()
Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value.
string
localtime(string $value, int $position = 0)
Not supported. Parse string to a field-based time value.
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
setTimeZone(IntlTimeZone|DateTimeZone|string|null $timeZone)
This method was added in PHP 5.5 as replacement for setTimeZoneId()
.
protected DateTime
createDateTime(int $timestamp)
Create and returns a DateTime object with the specified timestamp and with the current time zone.