You are here

function hijri_format_date in Hijri 8

Same name and namespace in other branches
  1. 7 hijri.module \hijri_format_date()
  • @file hijri.inc

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
hijri_handler_hijri_created::render in views/hijri_handler_hijri_created.inc
hijri_preprocess_comment in ./hijri.module
Prepares variables for comment templates.
hijri_preprocess_node in ./hijri.module
Prepares variables for node templates.
SettingsController::buildForm in src/Form/SettingsController.php
Form constructor.

... See full list

File

./hijri.module, line 156
hijri.module 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');
      $format = 'l, F j, Y - H:i';
      break;
    case 'medium':

      //$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
      $format = 'D, m/d/Y - H:i';
      break;
    case 'short':

      //$format = variable_get('date_format_short', 'm/d/Y - H:i');
      $format = 'm/d/Y - H:i';
      break;
    case 'custom':

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