You are here

public static function jDateTime::d2g in Persian Date for Drupal 8 8.4

Parameters

$jdn:

Return value

array

1 call to jDateTime::d2g()
jDateTime::toGregorian in src/Library/Jalali/jDateTime.php
Converts a Jalali date to Gregorian.

File

src/Library/Jalali/jDateTime.php, line 227

Class

jDateTime
Class jDateTime @package Morilog\Jalali

Namespace

Drupal\persian_date\Library\Jalali

Code

public static function d2g($jdn) {
  $j = 4 * $jdn + 139361631;
  $j += self::div(self::div(4 * $jdn + 183187720, 146097) * 3, 4) * 4 - 3908;
  $i = self::div(self::mod($j, 1461), 4) * 5 + 308;
  $gd = self::div(self::mod($i, 153), 5) + 1;
  $gm = self::mod(self::div($i, 153), 12) + 1;
  $gy = self::div($j, 1461) - 100100 + self::div(8 - $gm, 6);
  return [
    $gy,
    $gm,
    $gd,
  ];
}