Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Static Public Member Functions | |
static | setOptions (array $options=array()) |
static | convertNumerals ($input, $from, $to=null) |
static | getNumber ($input, array $options=array()) |
static | toNumber ($value, array $options=array()) |
static | isNumber ($input, array $options=array()) |
static | getFloat ($input, array $options=array()) |
static | toFloat ($value, array $options=array()) |
static | isFloat ($value, array $options=array()) |
static | getInteger ($input, array $options=array()) |
static | toInteger ($value, array $options=array()) |
static | isInteger ($value, array $options=array()) |
static | convertPhpToIsoFormat ($format) |
static | getDateFormat ($locale=null) |
static | getDate ($date, array $options=array()) |
static | checkDateFormat ($date, array $options=array()) |
static | getTimeFormat ($locale=null) |
static | getTime ($time, array $options=array()) |
static | getDateTimeFormat ($locale=null) |
static | getDateTime ($datetime, array $options=array()) |
Data Fields | |
const | STANDARD = 'auto' |
Static Protected Member Functions | |
static | _replaceMonth (&$number, $monthlist) |
static | _getUniCodeSupport () |
static | _getEncoding () |
static | _setEncoding ($encoding) |
Definition at line 35 of file Format.php.
|
staticprotected |
Internal method to retrieve the current encoding via the ini setting default_charset for PHP >= 5.6 or iconv_get_encoding otherwise.
Definition at line 1318 of file Format.php.
|
staticprotected |
Internal method to detect of Unicode supports UTF8 which should be enabled within vanilla php installations
Definition at line 1307 of file Format.php.
|
staticprotected |
Search $number for a month name found in $monthlist, and replace if found.
string | $number | Date string (modified) |
array | $monthlist | List of month names |
Definition at line 1104 of file Format.php.
|
staticprotected |
Internal method to set the encoding via the ini setting default_charset for PHP >= 5.6 or iconv_set_encoding otherwise.
string | $encoding |
Definition at line 1334 of file Format.php.
|
static |
Returns if the given datestring contains all date parts from the given format. If no format is given, the default date format from the locale is used If you want to check if the date is a proper date you should use Zend_Date::isDate()
string | $date | Date string |
array | $options | Options: format_type, fix_date, locale, date_format. See setOptions() for details. |
Definition at line 1174 of file Format.php.
|
static |
Changes the numbers/digits within a given string from one script to another 'Decimal' representated the stardard numbers 0-9, if a script does not exist an exception will be thrown.
Examples for conversion from Arabic to Latin numerals: convertNumerals('١١٠ Tests', 'Arab'); -> returns '100 Tests' Example for conversion from Latin to Arabic numerals: convertNumerals('100 Tests', 'Latn', 'Arab'); -> returns '١١٠ Tests'
string | $input | String to convert |
string | $from | Script to parse, see Zend_Locale::getScriptList() for details. |
string | $to | OPTIONAL Script to convert to |
Zend_Locale_Exception |
Definition at line 198 of file Format.php.
|
static |
Converts a format string from PHP's date format to ISO format Remember that Zend Date always returns localized string, so a month name which returns the english month in php's date() will return the translated month name with this function... use 'en' as locale if you are in need of the original english names
The conversion has the following restrictions: 'a', 'A' - Meridiem is not explicit upper/lowercase, you have to upper/lowercase the translated value yourself
string | $format | Format string in PHP's date format |
Definition at line 746 of file Format.php.
|
static |
Returns an array with the normalized date from an locale date a input of 10.01.2006 without a $locale would return: array ('day' => 10, 'month' => 1, 'year' => 2006) The 'locale' option is only used to convert human readable day and month names to their numeric equivalents. The 'format' option allows specification of self-defined date formats, when not using the default format for the 'locale'.
string | $date | Date string |
array | $options | Options: format_type, fix_date, locale, date_format. See setOptions() for details. |
Definition at line 1154 of file Format.php.
|
static |
Returns the default date format for $locale.
string | Zend_Locale | $locale | OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT') |
Zend_Locale_Exception | throws an exception when locale data is broken |
Definition at line 1130 of file Format.php.
|
static |
Returns an array with 'year', 'month', 'day', 'hour', 'minute', and 'second' elements extracted from $datetime according to the order described in $format. For a format of 'd.M.y H:i:s', and an input of 10.05.1985 11:20:55, getDateTime() would return: array ('year' => 1985, 'month' => 5, 'day' => 10, 'hour' => 11, 'minute' => 20, 'second' => 55) The optional $locale parameter may be used to help extract times from strings containing both a time and a day or month name.
string | $datetime | DateTime string |
array | $options | Options: format_type, fix_date, locale, date_format. See setOptions() for details. |
Definition at line 1291 of file Format.php.
|
static |
Returns the default datetime format for $locale.
string | Zend_Locale | $locale | OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT') |
Zend_Locale_Exception |
Definition at line 1269 of file Format.php.
|
static |
Alias for getNumber
string | $input | Number to localize |
array | $options | Options: locale, precision. See setOptions() for details. |
Definition at line 646 of file Format.php.
|
static |
Returns the first found integer from an string Parsing depends on given locale (grouping and decimal)
Examples for input: ' 2345.4356,1234' = 23455456 '+23,3452.123' = 233452 ' 12343 ' = 12343 '-9456km' = -9456 '0' = 0 '(-){0,1}(\d+(.){0,1})*(\,){0,1})\d+'
string | $input | Input string to parse for numbers |
array | $options | Options: locale. See setOptions() for details. |
Definition at line 694 of file Format.php.
|
static |
Returns the normalized number from a localized one Parsing depends on given locale (grouping and decimal)
Examples for input: '2345.4356,1234' = 23455456.1234 '+23,3452.123' = 233452.123 '12343 ' = 12343 '-9456' = -9456 '0' = 0
string | $input | Input string to parse for numbers |
array | $options | Options: locale, precision. See setOptions() for details. |
Zend_Locale_Exception |
Definition at line 246 of file Format.php.
|
static |
Returns an array with 'hour', 'minute', and 'second' elements extracted from $time according to the order described in $format. For a format of 'H:i:s', and an input of 11:20:55, getTime() would return: array ('hour' => 11, 'minute' => 20, 'second' => 55) The optional $locale parameter may be used to help extract times from strings containing both a time and a day or month name.
string | $time | Time string |
array | $options | Options: format_type, fix_date, locale, date_format. See setOptions() for details. |
Definition at line 1252 of file Format.php.
|
static |
Returns the default time format for $locale.
string | Zend_Locale | $locale | OPTIONAL Locale of $number, possibly in string form (e.g. 'de_AT') |
Zend_Locale_Exception |
Definition at line 1230 of file Format.php.
|
static |
Returns if a float was found Alias for isNumber()
string | $value | Localized number string |
array | $options | Options: locale. See setOptions() for details. |
Definition at line 673 of file Format.php.
|
static |
Returns if a integer was found
string | $value | Localized number string |
array | $options | Options: locale. See setOptions() for details. |
Definition at line 721 of file Format.php.
|
static |
Checks if the input contains a normalized or localized number
string | $input | Localized number string |
array | $options | Options: locale. See setOptions() for details. |
Definition at line 510 of file Format.php.
|
static |
Sets class wide options, if no option was given, the actual set options will be returned The 'precision' option of a value is used to truncate or stretch extra digits. -1 means not to touch the extra digits. The 'locale' option helps when parsing numbers and dates using separators and month names. The date format 'format_type' option selects between CLDR/ISO date format specifier tokens and PHP's date() tokens. The 'fix_date' option enables or disables heuristics that attempt to correct invalid dates. The 'number_format' option can be used to specify a default number format string The 'date_format' option can be used to specify a default date format string, but beware of using getDate(), checkDateFormat() and getTime() after using setOptions() with a 'format'. To use these four methods with the default date format for a locale, use array('date_format' => null, 'locale' => $locale) for their options.
array | $options | Array of options, keyed by option name: format_type = 'iso' | 'php', fix_date = true | false, locale = Zend_Locale | locale string, precision = whole number between -1 and 30 |
Zend_Locale_Exception |
Definition at line 64 of file Format.php.
|
static |
Returns a locale formatted integer number Alias for toNumber()
string | $value | Number to normalize |
array | $options | Options: locale, precision. See setOptions() for details. |
Definition at line 659 of file Format.php.
|
static |
Returns a localized number
string | $value | Number to normalize |
array | $options | Options: locale. See setOptions() for details. |
Definition at line 707 of file Format.php.
|
static |
Returns a locale formatted number depending on the given options. The seperation and fraction sign is used from the set locale.
string | $value | Localized number string |
array | $options | Options: number_format, locale, precision. See setOptions() for details. |
Zend_Locale_Exception |
Definition at line 300 of file Format.php.
const STANDARD = 'auto' |
Definition at line 37 of file Format.php.