You are here

function _clock_get_date_format in Clock 7

Gets the correct date format.

Parameters

$date_type: (optional) The date type to return the date format for. If omitted, uses the date type which is set for the clock.

Return value

The date format of the date type used for the clock.

2 calls to _clock_get_date_format()
clock_block_configure in ./clock.module
Implement hook_block_configure().
clock_block_view in ./clock.module
Implements hook_block_view().

File

./clock.module, line 211

Code

function _clock_get_date_format($date_type = NULL) {
  if (!isset($date_type)) {
    $date_type = variable_get('clock_date_type', 'long');
  }

  // 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. We
  // cannot use the fallback directly in variable_get(), because
  // system_get_date_formats() can return FALSE for custom date types. In
  // that case, the variable is always set, though.
  $date_format = variable_get('date_format_' . $date_type, NULL);
  if (!isset($date_format)) {
    $date_format = key(system_get_date_formats($date_type));
  }
  return $date_format;
}