1 date.module | _get_custom_date_format($date, $format) |
Get a custom date format.
File
- core/
modules/ date/ date.module, line 396 - Defines date/time field types.
Code
function _get_custom_date_format($date, $format) {
$custom = array();
$custom['granularities'] = array(
'date' => array('year', 'month', 'day'),
'time' => array('hour', 'minute', 'second'),
'zone' => array('timezone'),
);
$custom['limits'] = array(
'date' => date_limit_format($format, $custom['granularities']['date']),
'time' => date_limit_format($format, $custom['granularities']['time']),
'zone' => date_limit_format($format, $custom['granularities']['zone']),
);
return array(
'formatted' => date_format_date($date, 'custom', $format),
'date' => date_format_date($date, 'custom', $custom['limits']['date']),
'time' => date_format_date($date, 'custom', $custom['limits']['time']),
'zone' => date_format_date($date, 'custom', $custom['limits']['zone']),
);
}