| | __construct(string|null $locale, int $datetype, int $timetype, mixed $timezone = null, int|null $calendar = self::GREGORIAN, string $pattern = null) | |
| 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 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 | getLocale(int $type = Locale::ACTUAL_LOCALE) Returns the formatter's locale. | |
| string | getPattern() Returns the formatter's pattern. | |
| int | 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 = 0) Not supported. Parse string to a field-based time value. | |
| int | 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 setTimeZoneId(). | |
| DateTime | createDateTime(int $timestamp) Create and returns a DateTime object with the specified timestamp and with the current time zone. | |
| string | getDefaultPattern() Returns a pattern string based in the datetype and timetype values. | |
__construct(string|null $locale, int $datetype, int $timetype, mixed $timezone = null, int|null $calendar = self::GREGORIAN, string $pattern = null)
Parameters
| string|null | $locale | The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") |
| int | $datetype | Type of date formatting, one of the format type constants |
| int | $timetype | Type of time formatting, one of the format type constants |
| mixed | $timezone | Timezone identifier |
| int|null | $calendar | Calendar to use for formatting or parsing. The only currently supported value is IntlDateFormatter::GREGORIAN (or null using the default calendar, i.e. "GREGORIAN") |
| string | $pattern | Optional pattern to use when formatting |
Exceptions
See also
static IntlDateFormatter
create(string $locale, int $datetype, int $timetype, string $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null)
Static constructor.
Parameters
| string | $locale | The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") |
| int | $datetype | Type of date formatting, one of the format type constants |
| int | $timetype | Type of time formatting, one of the format type constants |
| string | $timezone | Timezone identifier |
| int | $calendar | Calendar to use for formatting or parsing; default is Gregorian One of the calendar constants |
| string | $pattern | Optional pattern to use when formatting |
Return Value
Exceptions
See also
Format the date/time value (timestamp) as a string.
Parameters
| int|DateTime
| $timestamp | The timestamp to format |
Return Value
| string|bool | The formatted value or false if formatting failed |
Exceptions
See also
Not supported. Formats an object.
Parameters
| object | $object | |
| mixed | $format | |
| string | $locale | |
Return Value
| string | The formatted value |
Exceptions
See also
int
getCalendar()
Returns the formatter's calendar.
Return Value
| int | The calendar being used by the formatter. Currently always returns IntlDateFormatter::GREGORIAN. |
See also
object
getCalendarObject()
Not supported. Returns the formatter's calendar object.
Return Value
| object | The calendar's object being used by the formatter |
Exceptions
See also
int
getDateType()
Returns the formatter's datetype.
Return Value
| int | The current value of the formatter |
See also
int
getErrorCode()
Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value.
Return Value
| int | The error code from last formatter call |
See also
string
getErrorMessage()
Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value.
Return Value
| string | The error message from last formatter call |
See also
string
getLocale(int $type = Locale::ACTUAL_LOCALE)
Returns the formatter's locale.
Parameters
| int | $type | Not supported. The locale name type to return (Locale::VALID_LOCALE or Locale::ACTUAL_LOCALE) |
Return Value
| string | The locale used to create the formatter. Currently always returns "en". |
See also
string
getPattern()
Returns the formatter's pattern.
Return Value
| string | The pattern string used by the formatter |
See also
int
getTimeType()
Returns the formatter's time type.
Return Value
| int | The time type used by the formatter |
See also
string
getTimeZoneId()
Returns the formatter's timezone identifier.
Return Value
| string | The timezone identifier used by the formatter |
See also
mixed
getTimeZone()
Not supported. Returns the formatter's timezone.
Return Value
| mixed | The timezone used by the formatter |
Exceptions
See also
bool
isLenient()
Returns whether the formatter is lenient.
Return Value
| bool | Currently always returns false |
Exceptions
See also
string
localtime(string $value, int $position = 0)
Not supported. Parse string to a field-based time value.
Parameters
| string | $value | String to convert to a time value |
| int | $position | Position at which to start the parsing in $value (zero-based) If no error occurs before $value is consumed, $parse_pos will contain -1 otherwise it will contain the position at which parsing ended. If $parse_pos > strlen($value), the parse fails immediately. |
Return Value
| string | Localtime compatible array of integers: contains 24 hour clock value in tm_hour field |
Exceptions
See also
int
parse(string $value, int $position = null)
Parse string to a timestamp value.
Parameters
| string | $value | String to convert to a time value |
| int | $position | Not supported. Position at which to start the parsing in $value (zero-based) If no error occurs before $value is consumed, $parse_pos will contain -1 otherwise it will contain the position at which parsing ended. If $parse_pos > strlen($value), the parse fails immediately. |
Return Value
| int | Parsed value as a timestamp |
Exceptions
See also
bool
setCalendar(string $calendar)
Not supported. Set the formatter's calendar.
Parameters
| string | $calendar | The calendar to use. Default is IntlDateFormatter::GREGORIAN |
Return Value
| bool | true on success or false on failure |
Exceptions
See also
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.
Parameters
| bool | $lenient | Sets whether the parser is lenient or not. Currently only false (strict) is supported. |
Return Value
| bool | true on success or false on failure |
Exceptions
See also
bool
setPattern(string $pattern)
Set the formatter's pattern.
Parameters
| string | $pattern | A pattern string in conformance with the ICU IntlDateFormatter documentation |
Return Value
| bool | true on success or false on failure |
See also
bool
setTimeZoneId(string $timeZoneId)
Set the formatter's timezone identifier.
Parameters
| string | $timeZoneId | The time zone ID string of the time zone to use. If NULL or the empty string, the default time zone for the runtime is used. |
Return Value
| bool | true on success or false on failure |
See also
bool
setTimeZone(mixed $timeZone)
This method was added in PHP 5.5 as replacement for setTimeZoneId().
Parameters
Return Value
| bool | true on success or false on failure |
See also
protected DateTime
createDateTime(int $timestamp)
Create and returns a DateTime object with the specified timestamp and with the current time zone.
Parameters
Return Value
protected string
getDefaultPattern()
Returns a pattern string based in the datetype and timetype values.
Return Value