You are here

public static function DatexObject::phpToIntl in Datex 7.2

Converts date format string (like 'Y-m-d') to it's PHP-Intl equivilant.

1 call to DatexObject::phpToIntl()
DatexObject::formatINTL in datex_api/datex_api.class.inc
Format datetime using PHP-Intl.

File

datex_api/datex_api.class.inc, line 500
Provides an API to work with dates.

Class

DatexObject
Base class for localized DateTime.

Code

public static function phpToIntl($format) {
  static $format_map = array(
    'd' => 'dd',
    'D' => 'EEE',
    'j' => 'd',
    'l' => 'EEEE',
    'N' => 'e',
    'S' => 'LLLL',
    'w' => '',
    'z' => 'D',
    'W' => 'w',
    'm' => 'MM',
    'M' => 'MMM',
    'F' => 'MMMM',
    'n' => 'M',
    't' => '',
    'L' => '',
    'o' => 'yyyy',
    'y' => 'yy',
    'Y' => 'YYYY',
    'a' => 'a',
    'A' => 'a',
    'B' => '',
    'g' => 'h',
    'G' => 'H',
    'h' => 'hh',
    'H' => 'HH',
    'i' => 'mm',
    's' => 'ss',
    'u' => 'SSSSSS',
    'e' => 'z',
    'I' => '',
    'O' => 'Z',
    'P' => 'ZZZZ',
    'T' => 'v',
    'Z' => '',
    'c' => '',
    'r' => '',
    'U' => '',
    ' ' => ' ',
    '-' => '-',
    '.' => '.',
    '-' => '-',
    ':' => ':',
  );
  $replace_pattern = '/[^ \\:\\-\\/\\.\\\\dDjlNSwzWmMFntLoyYaABgGhHisueIOPTZcrU]/';
  return strtr(preg_replace($replace_pattern, '', $format), $format_map);
}