You are here

function _calendar_systems_get_format in Calendar Systems 7.3

Same name and namespace in other branches
  1. 8 calendar_systems.helpers.inc \_calendar_systems_get_format()
  2. 6.3 calendar_systems.module \_calendar_systems_get_format()
  3. 6 calendar_systems.module \_calendar_systems_get_format()
  4. 7 calendar_systems.helpers.inc \_calendar_systems_get_format()
  5. 7.2 calendar_systems.helpers.inc \_calendar_systems_get_format()

Helper function

Parameters

$format:

$granularity:

Return value

string

1 call to _calendar_systems_get_format()
calendar_systems_preprocess_content_field in ./calendar_systems.module
For basic integration with views

File

./calendar_systems.module, line 478
Contains Calendar Systems hook implementations and helpers.

Code

function _calendar_systems_get_format($format, $granularity) {
  $new_format = '';
  switch ($format) {
    case 'small':
    case 'short':
      $new_format = variable_get('date_format_short', 'm/d/Y - H:i');
      break;
    case 'large':
      $new_format = variable_get('date_format_long', 'l, F j, Y - H:i');
      break;
    case 'medium':
      $new_format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
      break;
    default:
      $new_format = $format;
      break;
  }
  if ($granularity) {
    $new_format = _calendar_systems_fix_by_granularity($new_format, $granularity);
    $new_format = _calendar_systems_fix_whitespace($new_format, $granularity);
  }
  return $new_format;
}