You are here

function date_popup_format_to_popup_time in Date 6

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. 7.3 date_popup/date_popup.module \date_popup_format_to_popup_time()
  4. 7 date_popup/date_popup.module \date_popup_format_to_popup_time()
  5. 7.2 date_popup/date_popup.module \date_popup_format_to_popup_time()

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

Parameters

string $format: a normal date format string, like Y-m-d

Return value

string a format string in popup format, like YMD-

1 call to date_popup_format_to_popup_time()
date_popup_process_time in date_popup/date_popup.module
Process the time portion of the element.

File

date_popup/date_popup.module, line 411
A module to enable jquery calendar and time entry popups. Requires the Date API.

Code

function date_popup_format_to_popup_time($format) {
  if (empty($format)) {
    $format = 'H:i';
  }
  $format = str_replace(array(
    'G',
  ), 'H', $format);
  $format = str_replace(array(
    'g',
  ), 'h', $format);
  $format = str_replace(array(
    'a',
  ), 'A', $format);
  $format = str_replace(array(
    ' ',
    '/',
    '-',
    '.',
    'l',
    'z',
    'w',
    'W',
    'd',
    'j',
    'm',
    'n',
    'y',
    'Y',
  ), '', $format);
  return $format;
}