W3cubDocs

/Yii 2.0

Class yii\helpers\BaseFormatConverter

Inheritance yii\helpers\BaseFormatConverter
Subclasses yii\helpers\FormatConverter
Available since version 2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseFormatConverter.php

BaseFormatConverter provides concrete implementation for yii\helpers\FormatConverter.

Do not use BaseFormatConverter. Use yii\helpers\FormatConverter instead.

Public Properties

Property Type Description Defined By
$juiFallbackDatePatterns array The jQuery UI fallback definition to use for the ICU short patterns short, medium, long and full. yii\helpers\BaseFormatConverter
$phpFallbackDatePatterns array The php fallback definition to use for the ICU short patterns short, medium, long and full. yii\helpers\BaseFormatConverter

Public Methods

Method Description Defined By
convertDateIcuToJui() Converts a date format pattern from [ICU format][] to [jQuery UI date format][]. yii\helpers\BaseFormatConverter
convertDateIcuToPhp() Converts a date format pattern from [ICU format][] to [php date() function format][]. yii\helpers\BaseFormatConverter
convertDatePhpToIcu() Converts a date format pattern from [php date() function format][] to [ICU format][]. yii\helpers\BaseFormatConverter
convertDatePhpToJui() Converts a date format pattern from [php date() function format][] to [jQuery UI date format][]. yii\helpers\BaseFormatConverter

Property Details

$juiFallbackDatePatterns public static property

The jQuery UI fallback definition to use for the ICU short patterns short, medium, long and full. This is used as fallback when the intl extension is not installed.

public static array $juiFallbackDatePatterns = ['short' => ['date' => 'd/m/y', 'time' => '', 'datetime' => 'd/m/y'], 'medium' => ['date' => 'M d, yy', 'time' => '', 'datetime' => 'M d, yy'], 'long' => ['date' => 'MM d, yy', 'time' => '', 'datetime' => 'MM d, yy'], 'full' => ['date' => 'DD, MM d, yy', 'time' => '', 'datetime' => 'DD, MM d, yy']]

$phpFallbackDatePatterns public static property

The php fallback definition to use for the ICU short patterns short, medium, long and full. This is used as fallback when the intl extension is not installed.

public static array $phpFallbackDatePatterns = ['short' => ['date' => 'n/j/y', 'time' => 'H:i', 'datetime' => 'n/j/y H:i'], 'medium' => ['date' => 'M j, Y', 'time' => 'g:i:s A', 'datetime' => 'M j, Y g:i:s A'], 'long' => ['date' => 'F j, Y', 'time' => 'g:i:sA', 'datetime' => 'F j, Y g:i:sA'], 'full' => ['date' => 'l, F j, Y', 'time' => 'g:i:sA T', 'datetime' => 'l, F j, Y g:i:sA T']]

Method Details

convertDateIcuToJui() public static method

Converts a date format pattern from [ICU format][] to [jQuery UI date format][].

Pattern constructs that are not supported by the jQuery UI format will be removed.

public static string convertDateIcuToJui ( $pattern, $type = 'date', $locale = null )
$pattern string

Date format pattern in ICU format.

$type string

'date', 'time', or 'datetime'.

$locale string

The locale to use for converting ICU short patterns short, medium, long and full. If not given, Yii::$app->language will be used.

return string

The converted date format pattern.

convertDateIcuToPhp() public static method

Converts a date format pattern from [ICU format][] to [php date() function format][].

The conversion is limited to date patterns that do not use escaped characters. Patterns like d 'of' MMMM yyyy which will result in a date like 1 of December 2014 may not be converted correctly because of the use of escaped characters.

Pattern constructs that are not supported by the PHP format will be removed.

public static string convertDateIcuToPhp ( $pattern, $type = 'date', $locale = null )
$pattern string

Date format pattern in ICU format.

$type string

'date', 'time', or 'datetime'.

$locale string

The locale to use for converting ICU short patterns short, medium, long and full. If not given, Yii::$app->language will be used.

return string

The converted date format pattern.

convertDatePhpToIcu() public static method

Converts a date format pattern from [php date() function format][] to [ICU format][].

The conversion is limited to date patterns that do not use escaped characters. Patterns like jS \o\f F Y which will result in a date like 1st of December 2014 may not be converted correctly because of the use of escaped characters.

Pattern constructs that are not supported by the ICU format will be removed.

public static string convertDatePhpToIcu ( $pattern )
$pattern string

Date format pattern in php date()-function format.

return string

The converted date format pattern.

convertDatePhpToJui() public static method

Converts a date format pattern from [php date() function format][] to [jQuery UI date format][].

The conversion is limited to date patterns that do not use escaped characters. Patterns like jS \o\f F Y which will result in a date like 1st of December 2014 may not be converted correctly because of the use of escaped characters.

Pattern constructs that are not supported by the jQuery UI format will be removed.

public static string convertDatePhpToJui ( $pattern )
$pattern string

Date format pattern in php date()-function format.

return string

The converted date format pattern.

© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc-2.0/yii-helpers-baseformatconverter.html