function date_formatter_format in Date 6.2
Same name and namespace in other branches
- 8 date.module \date_formatter_format()
- 5.2 date/date.module \date_formatter_format()
- 6 date/date.module \date_formatter_format()
- 7.3 date.module \date_formatter_format()
- 7 date.module \date_formatter_format()
- 7.2 date.module \date_formatter_format()
Helper function to return the date format used by a specific formatter.
1 call to date_formatter_format()
- date_formatter_process in date/
date.module - Helper function for creating formatted date arrays from a formatter.
File
- date/
date.module, line 560 - Defines date/time field types for the Content Construction Kit (CCK).
Code
function date_formatter_format($formatter, $field_name) {
$fields = content_fields();
$field = $fields[$field_name];
$default = variable_get('date_format_medium', 'D, m/d/Y - H:i');
switch ($formatter) {
case 'format_interval':
return 'format_interval';
case 'default':
$format = variable_get('date_format_' . $field['default_format'], $default);
break;
default:
$format = variable_get('date_format_' . $formatter, $default);
break;
}
if (empty($format)) {
$format = $default;
}
// A selected format might include timezone information.
$granularity = date_granularity($field);
array_push($granularity, 'timezone');
return date_limit_format($format, $granularity);
}