function date_formatter_format in Date 6
Same name and namespace in other branches
- 8 date.module \date_formatter_format()
- 5.2 date/date.module \date_formatter_format()
- 6.2 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 412 - 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];
if ($field['tz_handling'] == 'date') {
$field['granularity'][] = 'timezone';
}
switch ($formatter) {
case 'ical':
return 'Ymd\\THis';
case 'timestamp':
return 'U';
case 'iso':
return DATE_FORMAT_ISO . 'P';
case 'feed':
return 'D, j M Y H:i:s O';
case 'format_interval':
return 'format_interval';
case 'long':
case 'medium':
case 'short':
case 'default':
$custom = 'output_format_custom' . ($formatter != 'default' ? '_' . $formatter : '');
$value = 'output_format_date' . ($formatter != 'default' ? '_' . $formatter : '');
if ($field[$custom] > '') {
$format = $field[$custom];
}
elseif ($field[$value]) {
$format = $field[$value];
}
else {
switch ($formatter) {
case 'long':
$format = variable_get('date_format_long', 'l, F j, Y - H:i');
break;
case 'medium':
$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
break;
default:
$format = variable_get('date_format_short', 'm/d/Y - H:i');
break;
}
}
break;
}
return date_limit_format($format, date_granularity($field));
}