Methods summary
public
MvcCore\Ext\Views\Helpers\FormatDateHelper
|
#
SetIntlDefaultDateFormatter( integer|null $intlDefaultDateFormatter )
Set default date type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default date type will be used.
Set default date type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default date type will be used.
Parameters
- $intlDefaultDateFormatter
Returns
|
public
MvcCore\Ext\Views\Helpers\FormatDateHelper
|
#
SetIntlDefaultTimeFormatter( integer|null $intlDefaultTimeFormatter )
Set default time type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default time type will be used.
Set default time type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default time type will be used.
Parameters
- $intlDefaultTimeFormatter
Returns
|
public
MvcCore\Ext\Views\Helpers\FormatDateHelper
|
#
SetIntlDefaultTimeZone( string|IntlTimeZone|DateTimeZone|null $intlDefaultTimeZone )
Set default time zone ID. The default (and the one used if NULL is given)
is the one returned by date_default_timezone_get() or, if applicable,
that of the \IntlCalendar object passed for the calendar parameter.
This ID must be a valid identifier on ICUʼs database or an ID
representing an explicit offset, such as GMT-05:30.
Set default time zone ID. The default (and the one used if NULL is given)
is the one returned by date_default_timezone_get() or, if applicable,
that of the \IntlCalendar object passed for the calendar parameter.
This ID must be a valid identifier on ICUʼs database or an ID
representing an explicit offset, such as GMT-05:30.
Parameters
Returns
|
public
MvcCore\Ext\Views\Helpers\FormatDateHelper
|
#
SetIntlDefaultCalendar( integer|null $intlDefaultCalendar )
Set default calendar to use for formatting or parsing. The default value is NULL,
which corresponds to \IntlDateFormatter::GREGORIAN . This can either be
one of the \IntlDateFormatter calendar constants or an \IntlCalendar .
Any \IntlCalendar object passed will be clone; it will not be changed
by the \IntlDateFormatter . This will determine the calendar type used
(gregorian , islamic , persian , etc.) and, if NULL is given for the
timezone parameter, also the timezone used.
Set default calendar to use for formatting or parsing. The default value is NULL,
which corresponds to \IntlDateFormatter::GREGORIAN . This can either be
one of the \IntlDateFormatter calendar constants or an \IntlCalendar .
Any \IntlCalendar object passed will be clone; it will not be changed
by the \IntlDateFormatter . This will determine the calendar type used
(gregorian , islamic , persian , etc.) and, if NULL is given for the
timezone parameter, also the timezone used.
Parameters
Returns
See
http://php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants.calendartypes
|
public
MvcCore\Ext\Views\Helpers\FormatDateHelper
|
#
SetStrftimeFormatMask( string $strftimeFormatMask = '%e. %B %G, %H:%M:%S' )
Set custom format mask used by PHP strftime(); .
This method is used only for fallback if formatting is not by Intl extension.
Set custom format mask used by PHP strftime(); .
This method is used only for fallback if formatting is not by Intl extension.
Parameters
- $strftimeFormatMask
- $formatMask
Returns
See
http://php.net/strftime
|
public
string
|
#
FormatDate( DateTime|IntlCalendar|integer|null $dateTimeOrTimestamp = NULL, integer|string|null $dateTypeOrFormatMask = NULL, integer|null $timeType = NULL, string|IntlTimeZone|DateTimeZone|null $timeZone = NULL, integer|null $calendar = NULL )
Format given date by datefmt_format() (in Intl extension) or by strftime() as fallback.
If you don't want to specify all arguments for each helper callback, use setters
instead to set up default values for Intl extension formatting r for strftime() formatting.
You can use $this->GetHelper('FormatDate')->SetAnything(...); in view template
or \MvcCore\Ext\Views\Helpers\FormatDateHelper::GetInstance()->SetAnything(...); anywhere else.
Format given date by datefmt_format() (in Intl extension) or by strftime() as fallback.
If you don't want to specify all arguments for each helper callback, use setters
instead to set up default values for Intl extension formatting r for strftime() formatting.
You can use $this->GetHelper('FormatDate')->SetAnything(...); in view template
or \MvcCore\Ext\Views\Helpers\FormatDateHelper::GetInstance()->SetAnything(...); anywhere else.
Parameters
- $dateTimeOrTimestamp
Value to format. This may be a \DateTime\ object, an \IntlCalendar\ object,
a numeric type representing a (possibly fractional) number of seconds since
epoch or an array in the format output by localtime().
- $dateTypeOrFormatMask
Any custom \IntlDateFormatter constant to specify second argument int $datetype for
datefmt_create() function or custom strftime() format mask used as fallback.
Default date types to use (if NULL , ICUʼs default date type will be used):
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
Fallback format mask for strftime() could look like "%e. %B %G, %H:%M:%S" .
- $timeType
Any custom \IntlDateFormatter constant to specify third argument int $timetype for datefmt_create() .
Time types to use (if NULL , ICUʼs default time type will be used):
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
- $timeZone
Any custom time zone ID. The default (and the one used if NULL is given)
is the one returned by date_default_timezone_get() or, if applicable, that
of the \IntlCalendar object passed for the calendar parameter. This ID must
be a valid identifier on ICUʼs database or an ID representing an explicit
offset, such as GMT-05:30. If you want to specify custom timezone for whole
application, use date_default_timezone_set('Europe/Prague'); ...
- $calendar
Calendar to use for formatting or parsing. The default value is NULL , which corresponds to
\IntlDateFormatter::GREGORIAN . This can either be one of the \IntlDateFormatter calendar
constants or an IntlCalendar. Any IntlCalendar object passed will be clone; it will not be
changed by the IntlDateFormatter. This will determine the calendar type used (gregorian,
islamic, persian, etc.) and, if NULL is given for the timezone parameter, also the timezone used.
Returns
string
See
http://php.net/manual/en/intldateformatter.create.php
http://php.net/strftime
|
protected
IntlDateFormatter
|
#
getIntlDatetimeFormatter( string|null $langAndLocale = NULL, integer|null $dateType = NULL, integer|null $timeType = NULL, string|IntlTimeZone|DateTimeZone|null $timeZone = NULL, integer|null $calendar = NULL )
Get stored \IntlDateFormatter instance or create new one.
Get stored \IntlDateFormatter instance or create new one.
Parameters
- $langAndLocale
- $dateType
- $timeType
- $timeZone
- $calendar
Returns
IntlDateFormatter
|
Properties summary
protected static
MvcCore\Ext\Views\Helpers\FormatDateHelper
|
$instance
If this static property is set - helper is possible
to configure as singleton before it's used for first time.
Example:
\MvcCore\Ext\Views\Helpers\FormatDateHelper::GetInstance()
If this static property is set - helper is possible
to configure as singleton before it's used for first time.
Example:
\MvcCore\Ext\Views\Helpers\FormatDateHelper::GetInstance()
|
|
protected
integer|null
|
$intlDefaultDateFormatter
Default date type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default date type will be used.
Default date type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default date type will be used.
See
http://php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants
|
|
protected
integer|null
|
$intlDefaultTimeFormatter
Default time type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default time type will be used.
Default time type to use:
- \IntlDateFormatter::NONE - Do not include this element
- \IntlDateFormatter::SHORT - Most abbreviated style, only essential data (12/13/52 or 3:30pm)
- \IntlDateFormatter::MEDIUM - Medium style (Jan 12, 1952)
- \IntlDateFormatter::LONG - Long style (January 12, 1952 or 3:30:32pm)
- \IntlDateFormatter::FULL - Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST)
If NULL , ICUʼs default time type will be used.
See
http://php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants
|
|
protected
string|IntlTimeZone|DateTimeZone|null
|
$intlDefaultTimeZone
Time zone ID. The default (and the one used if NULL is given)
is the one returned by date_default_timezone_get() or, if applicable,
that of the \IntlCalendar object passed for the calendar parameter.
This ID must be a valid identifier on ICUʼs database or an ID
representing an explicit offset, such as GMT-05:30.
Time zone ID. The default (and the one used if NULL is given)
is the one returned by date_default_timezone_get() or, if applicable,
that of the \IntlCalendar object passed for the calendar parameter.
This ID must be a valid identifier on ICUʼs database or an ID
representing an explicit offset, such as GMT-05:30.
|
|
protected
integer|null
|
$intlDefaultCalendar
Calendar to use for formatting or parsing. The default value is NULL,
which corresponds to \IntlDateFormatter::GREGORIAN . This can either be
one of the \IntlDateFormatter calendar constants or an \IntlCalendar .
Any \IntlCalendar object passed will be clone; it will not be changed
by the \IntlDateFormatter . This will determine the calendar type used
(gregorian , islamic , persian , etc.) and, if NULL is given for the
timezone parameter, also the timezone used.
Calendar to use for formatting or parsing. The default value is NULL,
which corresponds to \IntlDateFormatter::GREGORIAN . This can either be
one of the \IntlDateFormatter calendar constants or an \IntlCalendar .
Any \IntlCalendar object passed will be clone; it will not be changed
by the \IntlDateFormatter . This will determine the calendar type used
(gregorian , islamic , persian , etc.) and, if NULL is given for the
timezone parameter, also the timezone used.
See
http://php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants.calendartypes
|
|
protected
int[]
|
$localeCategories
System setlocale() category to set up system locale automatically
in parent::setUpSystemLocaleAndEncodings() method.
This property is used only for fallback if formatting is not by Intl extension.
System setlocale() category to set up system locale automatically
in parent::setUpSystemLocaleAndEncodings() method.
This property is used only for fallback if formatting is not by Intl extension.
|
|
protected
string
|
$strftimeFormatMask
Custom format mask in used by PHP strftime(); :
This property is used only for fallback if formatting is not by Intl extension.
Custom format mask in used by PHP strftime(); :
This property is used only for fallback if formatting is not by Intl extension.
See
http://php.net/strftime
|
|