Symfony2 API
Class

Symfony\Component\Locale\Stub\StubIntlDateFormatter

class StubIntlDateFormatter extends IntlDateFormatter

Alias of {@link \Symfony\Component\Intl\DateFormatter\IntlDateFormatter}.

Constants

NONE

FULL

LONG

MEDIUM

SHORT

TRADITIONAL

GREGORIAN

Methods

__construct(string $locale, int $datetype, int $timetype, string $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null)

Constructor

from IntlDateFormatter
static IntlDateFormatter create(string $locale, int $datetype, int $timetype, string $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null)

Static constructor

from IntlDateFormatter
string|Boolean format(integer|DateTime $timestamp)

Format the date/time value (timestamp) as a string

from IntlDateFormatter
string formatObject(object $object, mixed $format = null, string $locale = null)

Not supported.

from IntlDateFormatter
int getCalendar()

Returns the formatter's calendar

from IntlDateFormatter
object getCalendarObject()

Not supported.

from IntlDateFormatter
int getDateType()

Returns the formatter's datetype

from IntlDateFormatter
int getErrorCode()

Returns formatter's last error code.

from IntlDateFormatter
string getErrorMessage()

Returns formatter's last error message.

from IntlDateFormatter
string getLocale(int $type = Locale::ACTUAL_LOCALE)

Returns the formatter's locale

from IntlDateFormatter
string getPattern()

Returns the formatter's pattern

from IntlDateFormatter
string getTimeType()

Returns the formatter's time type

from IntlDateFormatter
string getTimeZoneId()

Returns the formatter's timezone identifier

from IntlDateFormatter
mixed getTimeZone()

Not supported.

from IntlDateFormatter
Boolean isLenient()

Returns whether the formatter is lenient

from IntlDateFormatter
string localtime(string $value, int $position)

Not supported.

from IntlDateFormatter
string parse(string $value, int $position = null)

Parse string to a timestamp value

from IntlDateFormatter
Boolean setCalendar(string $calendar)

Not supported.

from IntlDateFormatter
Boolean setLenient(Boolean $lenient)

Set the leniency of the parser

from IntlDateFormatter
Boolean setPattern(string $pattern)

Set the formatter's pattern

from IntlDateFormatter
Boolean setTimeZoneId(string $timeZoneId)

Set the formatter's timezone identifier

from IntlDateFormatter
Boolean setTimeZone(mixed $timeZone)

This method was added in PHP 5.5 as replacement for `setTimeZoneId()`

from IntlDateFormatter

Details

in IntlDateFormatter at line 146
public __construct(string $locale, int $datetype, int $timetype, string $timezone = null, int $calendar = self::GREGORIAN, string $pattern = null)

Constructor

Parameters

string $locale The locale code. The only currently supported locale is "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. The only currently supported value is IntlDateFormatter::GREGORIAN.
string $pattern Optional pattern to use when formatting

Exceptions

MethodArgumentValueNotImplementedException When $locale different than "en" is passed
MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed

See also

http://www.php.net/manual/en/intldateformatter.create.php
http://userguide.icu-project.org/formatparse/datetime

in IntlDateFormatter at line 182
static public 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".
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

IntlDateFormatter

Exceptions

MethodArgumentValueNotImplementedException When $locale different than "en" is passed
MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed

See also

http://www.php.net/manual/en/intldateformatter.create.php
http://userguide.icu-project.org/formatparse/datetime

in IntlDateFormatter at line 199
public string|Boolean format(integer|DateTime $timestamp)

Format the date/time value (timestamp) as a string

Parameters

integer|DateTime $timestamp The timestamp to format. \DateTime objects are supported as of PHP 5.3.4.

Return Value

string|Boolean The formatted value or false if formatting failed.

Exceptions

MethodArgumentValueNotImplementedException If one of the formatting characters is not implemented

See also

http://www.php.net/manual/en/intldateformatter.format.php

in IntlDateFormatter at line 258
public string formatObject(object $object, mixed $format = null, string $locale = null)

Not supported.

Formats an object

Parameters

object $object
mixed $format
string $locale

Return Value

string The formatted value

Exceptions

MethodNotImplementedException

See also

http://www.php.net/manual/en/intldateformatter.formatobject.php

in IntlDateFormatter at line 271
public int getCalendar()

Returns the formatter's calendar

Return Value

int The calendar being used by the formatter. Currently always returns IntlDateFormatter::GREGORIAN.

See also

http://www.php.net/manual/en/intldateformatter.getcalendar.php

in IntlDateFormatter at line 285
public object getCalendarObject()

Not supported.

Returns the formatter's calendar object

Return Value

object The calendar's object being used by the formatter

Exceptions

MethodNotImplementedException

See also

http://www.php.net/manual/en/intldateformatter.getcalendarobject.php

in IntlDateFormatter at line 297
public int getDateType()

Returns the formatter's datetype

Return Value

int The current value of the formatter

See also

http://www.php.net/manual/en/intldateformatter.getdatetype.php

in IntlDateFormatter at line 309
public 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

http://www.php.net/manual/en/intldateformatter.geterrorcode.php

in IntlDateFormatter at line 321
public 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

http://www.php.net/manual/en/intldateformatter.geterrormessage.php

in IntlDateFormatter at line 336
public 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

http://www.php.net/manual/en/intldateformatter.getlocale.php

in IntlDateFormatter at line 348
public string getPattern()

Returns the formatter's pattern

Return Value

string The pattern string used by the formatter

See also

http://www.php.net/manual/en/intldateformatter.getpattern.php

in IntlDateFormatter at line 360
public string getTimeType()

Returns the formatter's time type

Return Value

string The time type used by the formatter

See also

http://www.php.net/manual/en/intldateformatter.gettimetype.php

in IntlDateFormatter at line 372
public string getTimeZoneId()

Returns the formatter's timezone identifier

Return Value

string The timezone identifier used by the formatter

See also

http://www.php.net/manual/en/intldateformatter.gettimezoneid.php

in IntlDateFormatter at line 395
public mixed getTimeZone()

Not supported.

Returns the formatter's timezone

Return Value

mixed The timezone used by the formatter

Exceptions

MethodNotImplementedException

See also

http://www.php.net/manual/en/intldateformatter.gettimezone.php

in IntlDateFormatter at line 409
public Boolean isLenient()

Returns whether the formatter is lenient

Return Value

Boolean Currently always returns false.

Exceptions

MethodNotImplementedException

See also

http://www.php.net/manual/en/intldateformatter.islenient.php

in IntlDateFormatter at line 429
public string localtime(string $value, int $position)

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

MethodNotImplementedException

See also

http://www.php.net/manual/en/intldateformatter.localtime.php

in IntlDateFormatter at line 449
public string 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

string Parsed value as a timestamp

Exceptions

MethodArgumentNotImplementedException When $position different than null, behavior not implemented

See also

http://www.php.net/manual/en/intldateformatter.parse.php

in IntlDateFormatter at line 479
public Boolean setCalendar(string $calendar)

Not supported.

Set the formatter's calendar

Parameters

string $calendar The calendar to use. Default is IntlDateFormatter::GREGORIAN.

Return Value

Boolean true on success or false on failure

Exceptions

MethodNotImplementedException

See also

http://www.php.net/manual/en/intldateformatter.setcalendar.php

in IntlDateFormatter at line 501
public Boolean setLenient(Boolean $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

Boolean $lenient Sets whether the parser is lenient or not. Currently only false (strict) is supported.

Return Value

Boolean true on success or false on failure

Exceptions

MethodArgumentValueNotImplementedException When $lenient is true

See also

http://www.php.net/manual/en/intldateformatter.setlenient.php

in IntlDateFormatter at line 520
public Boolean setPattern(string $pattern)

Set the formatter's pattern

Parameters

string $pattern A pattern string in conformance with the ICU IntlDateFormatter documentation

Return Value

Boolean true on success or false on failure

See also

http://www.php.net/manual/en/intldateformatter.setpattern.php
http://userguide.icu-project.org/formatparse/datetime

in IntlDateFormatter at line 542
public Boolean 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

Boolean true on success or false on failure

See also

http://www.php.net/manual/en/intldateformatter.settimezoneid.php

in IntlDateFormatter at line 591
public Boolean setTimeZone(mixed $timeZone)

This method was added in PHP 5.5 as replacement for `setTimeZoneId()`

Parameters

mixed $timeZone

Return Value

Boolean true on success or false on failure

See also

http://www.php.net/manual/en/intldateformatter.settimezone.php