function clock_get_date_format in Clock 7.2
Same name and namespace in other branches
- 6 clock.module \clock_get_date_format()
Gets the correct date format.
Parameters
$clock: A clock object as returned from clock_info().
Return value
The date format of the date type used for the clock.
3 calls to clock_get_date_format()
- ClockBlockTestCase::testClockBlock in ./
clock.test - clock_tokens in ./
clock.tokens.inc - Implements hook_tokens().
- theme_clock in ./
clock.theme.inc
File
- ./
clock.module, line 546 - Display clocks on your site.
Code
function clock_get_date_format($clock) {
$format = variable_get('date_format_' . $clock->date_type, NULL);
// Each date format type has a corresponding variable. If it is not set, get
// the list of date formats for that type and use the first one.
if (empty($format)) {
$formats = system_get_date_formats($clock->date_type);
if (!empty($formats)) {
$format = key($formats);
}
}
// If no formats were found, fallback to the medium date type.
if (empty($format)) {
$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
}
return $format;
}