You are here

function hijri_format_date in Hijri 7

Same name and namespace in other branches
  1. 8 hijri.module \hijri_format_date()

@file Retrive Hijri date like Drupal format_date function.

6 calls to hijri_format_date()
hijri_handler_hijri_created::options_form in views/hijri_handler_hijri_created.inc
Here are the form options.
hijri_handler_hijri_created::render in views/hijri_handler_hijri_created.inc
Hijri reneding.
hijri_preprocess_comment in ./hijri.module
Process variables for comment.tpl.php.
hijri_preprocess_node in ./hijri.module
Processes variables for node.tpl.php.
hijri_settings_form in ./hijri.module
Form builder.

... See full list

File

./hijri.module, line 405
This module convert to Hijri date in nodes,comments and a block.

Code

function hijri_format_date($timestamp, $type = 'medium', $format = '', $correction = 0) {
  switch ($type) {
    case 'full':
      return t('@hijri on @gregorian', array(
        '@hijri' => hijri('l j F  Y', $timestamp, $correction),
        '@gregorian' => format_date($timestamp, 'custom', 'F j, Y'),
      ));
    case 'long':
      $format = variable_get('date_format_long', 'l, F j, Y - H:i');
      break;
    case 'medium':
      $format = variable_get('date_format_medium', 'D, d/m/Y - H:i');
      break;
    case 'short':
      $format = variable_get('date_format_short', 'd/m/Y - H:i');
      break;
    case 'custom':

      // No change to format.
      break;
  }
  return hijri($format, $timestamp, $correction);
}