1 date.elements.inc _date_popup_format_to_popup_time($format)

Recreate a time format string so it has the values popup expects.

Parameters

string $format: A normal time format string, like h:i (a)

Return value

string: A format string that the popup can accept like h:i a

File

core/modules/date/date.elements.inc, line 1342
Date forms and form themes and validation.

Code

function _date_popup_format_to_popup_time($format) {
  if (empty($format)) {
    $format = 'H:i';
  }
  $symbols = array(
    '/',
    '-',
    ' .',
    ',',
    'F',
    'M',
    'l',
    'z',
    'w',
    'W',
    'd',
    'j',
    'm',
    'n',
    'y',
    'Y',
  );
  $format = str_replace($symbols, '', $format);
  $format = strtr($format, array('G' => 'H', 'g' => 'h'));
  return $format;
}