function _views_date_format_sql_get_date_format in Views Date Format SQL 7.3
Helper to retrieve the format to a given date format name. see includes/common.inc:function format_date()
2 calls to _views_date_format_sql_get_date_format()
- views_date_format_sql_handler_date::query in includes/
views_date_format_sql_handler_date.inc - Called to add the field to a query.
- views_date_format_sql_handler_date_field::query in includes/
views_date_format_sql_handler_date_field.inc - Called to add the field to a query.
File
- ./
views_date_format_sql.module, line 16
Code
function _views_date_format_sql_get_date_format($type = 'medium', $format = '') {
switch ($type) {
case 'short':
$format = variable_get('date_format_short', 'm/d/Y - H:i');
break;
case 'long':
$format = variable_get('date_format_long', 'l, F j, Y - H:i');
break;
case 'custom':
// No change to format.
break;
case 'medium':
default:
// Retrieve the format of the custom $type passed.
if ($type != 'medium') {
$format = variable_get('date_format_' . $type, '');
}
// Fall back to 'medium'.
if ($format === '') {
$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
}
break;
}
return $format;
}