function date_get_format in Date 8
Same name and namespace in other branches
- 6.2 date_api.module \date_get_format()
2 calls to date_get_format()
- date_combo_element_process in ./
date_elements.inc - Process an individual date element.
- date_combo_validate in ./
date_elements.inc - Validate and update a combo element. Don't try this if there were errors before reaching this point.
File
- date_api/
date_api.module, line 24 - This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.
Code
function date_get_format($instance, $part = 'all') {
switch ($instance['widget']['type']) {
case 'date_select':
$date_format = $instance['widget']['date_date_format'];
$time_format = '';
break;
case 'date_popup':
$date_format = datetime_get_format('date', $instance['widget']['date_date_format']);
$time_format = datetime_get_format('date', $instance['widget']['date_time_format']);
break;
}
switch ($part) {
case 'date':
return $date_format;
case 'time':
return $time_format;
default:
return trim($date_format . ' ' . $time_format);
}
return $format;
}