You are here

function _calendar_systems_fix_by_granularity in Calendar Systems 7.3

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

Helper function

Parameters

$format:

$granularity:

Return value

string

1 call to _calendar_systems_fix_by_granularity()
_calendar_systems_get_format in ./calendar_systems.module
Helper function

File

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

Code

function _calendar_systems_fix_by_granularity($format, $granularity) {
  $new_format = '';
  $list = _calendar_systems_get_date_format();
  for ($i = 0; $i < strlen($format); $i++) {
    $c = $format[$i];
    if (isset($list[$c])) {
      if (isset($granularity[$list[$c]])) {
        $new_format .= $c;
      }
    }
    else {
      $new_format .= $c;
    }
  }
  return $new_format;
}