function date_part_format in Date 7.2
Same name and namespace in other branches
- 7.3 date_api/date_api.module \date_part_format()
Helper function to get a format for a specific part of a date field.
Parameters
string $part: The date field part, either 'time' or 'date'.
string $format: A date format string.
Return value
string The date format for the given part.
3 calls to date_part_format()
- date_all_day_date_combo_pre_validate_alter in date_all_day/
date_all_day.module - Implements hook_date_combo_pre_validate_alter().
- date_all_day_value in date_all_day/
date_all_day.module - A helper function date_all_day_value().
- hook_date_combo_pre_validate_alter in ./
date.api.php - Alter the date_combo element before the rest of the validation is run.
File
- date_api/
date_api.module, line 2316 - This module will make the date API available to other modules.
Code
function date_part_format($part, $format) {
switch ($part) {
case 'date':
return date_limit_format($format, array(
'year',
'month',
'day',
));
case 'time':
return date_limit_format($format, array(
'hour',
'minute',
'second',
));
default:
return date_limit_format($format, array(
$part,
));
}
}