function date_popup_format_to_popup in Date 5.2
Same name and namespace in other branches
- 6.2 date_popup/date_popup.module \date_popup_format_to_popup()
- 6 date_popup/date_popup.module \date_popup_format_to_popup()
- 7.3 date_popup/date_popup.module \date_popup_format_to_popup()
- 7 date_popup/date_popup.module \date_popup_format_to_popup()
- 7.2 date_popup/date_popup.module \date_popup_format_to_popup()
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()
- date_popup_process_date in date_popup/
date_popup.module - Process the date portion of the element.
File
- date_popup/
date_popup.module, line 422 - A module to enable jquery calendar and time entry popups. Requires the Date API.
Code
function date_popup_format_to_popup($format) {
if (empty($format)) {
$format = 'Y-m-d';
}
$sep = array();
ereg('\\/|-|\\.| ', $format, $sep);
$format = str_replace(array(
'd',
'j',
), 'D', $format);
$format = str_replace(array(
'm',
'n',
), 'M', $format);
$format = str_replace('y', 'Y', $format);
$format = str_replace(array(
' ',
'/',
'-',
'.',
':',
'l',
'z',
'w',
'W',
'g',
'G',
'h',
'H',
'i',
's',
'a',
'A',
), '', $format);
return $format . $sep[0];
}