Skip to content

FormatConverter ​

Type
Class
Namespace
craft\i18n
Inherits
craft\i18n\FormatConverter » yii\helpers\FormatConverter » yii\helpers\BaseFormatConverter
Since
3.0.6

View source

Public Properties ​

PropertyDescription
juiFallbackDatePatternsarray – The jQuery UI fallback definition to use for the ICU short patterns short, medium, long and full.
phpFallbackDatePatternsarray – The php fallback definition to use for the ICU short patterns short, medium, long and full.

Public Methods ​

MethodDescription
convertDateIcuToJui()Converts a date format pattern from ICU format to jQuery UI date format.
convertDateIcuToPhp()Converts a date format pattern from ICU format to PHP date() function format.
convertDatePhpToHuman()Converts a date format pattern from PHP date format to a human-readable format.
convertDatePhpToIcu()Converts a date format pattern from PHP date() function format to ICU format.
convertDatePhpToJui()Converts a date format pattern from PHP date() function format to jQuery UI date format.

convertDatePhpToHuman() ​

Since
4.3.0

Converts a date format pattern from PHP date format to a human-readable format.

The following patterns are supported:

  • d/j (DD)
  • m/n (MM)
  • Y (YYYY)
  • y (YY)
  • a/A (AM/PM)
  • g/G/h/H (HH)
  • i (MM)
  • s (SS)

View source

Arguments ​

  • $pattern (string) – Date format pattern in php date()-function format.

Returns ​

string – The converted date format pattern.

convertDatePhpToIcu() ​

Converts a date format pattern from PHP date() function format to ICU format.

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

Since 2.0.13 it handles escaped characters correctly.

View source

Arguments ​

  • $pattern (string) – Date format pattern in PHP date() function format.

Returns ​

string – The converted date format pattern.