You are here

function date_popup_format_to_popup_time in Date 7.2

Same name and namespace in other branches
  1. 5.2 date_popup/date_popup.module \date_popup_format_to_popup_time()
  2. 6.2 date_popup/date_popup.module \date_popup_format_to_popup_time()
  3. 6 date_popup/date_popup.module \date_popup_format_to_popup_time()
  4. 7.3 date_popup/date_popup.module \date_popup_format_to_popup_time()
  5. 7 date_popup/date_popup.module \date_popup_format_to_popup_time()

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

2 calls to date_popup_format_to_popup_time()
date_popup_process_time_part in date_popup/date_popup.module
Process the time portion of the element.
date_popup_time_format in date_popup/date_popup.module
Date popup time format.

File

date_popup/date_popup.module, line 735
A module to enable jQuery calendar and time entry popups.

Code

function date_popup_format_to_popup_time($format, $timepicker = NULL) {
  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, date_popup_timepicker_format_replacements($timepicker));
  return $format;
}