You are here

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

Calculates the Julian Day number from Gregorian or Julian calendar dates. This integer number corresponds to the noon of the date (i.e. 12 hours of Universal Time). The procedure was tested to be good since 1 March, -100100 (of both calendars) up to a few million years into the future.

Parameters

int $gy Calendar year (years BC numbered 0, -1, -2, ...):

int $gm Calendar month (1 to 12):

int $gd Calendar day of the month (1 to 28/29/30/31):

Return value

int Julian Day number

3 calls to jDateTime::g2d()
jDateTime::d2j in src/Library/Jalali/jDateTime.php
Converts the Julian Day number to a date in the Jalaali calendar.
jDateTime::j2d in src/Library/Jalali/jDateTime.php
Converts a date of the Jalaali calendar to the Julian Day number.
jDateTime::toJalali in src/Library/Jalali/jDateTime.php
Converts a Gregorian date to Jalali.

File

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

Class

jDateTime
Class jDateTime @package Morilog\Jalali

Namespace

Drupal\persian_date\Library\Jalali

Code

public static function g2d($gy, $gm, $gd) {
  return self::div(($gy + self::div($gm - 8, 6) + 100100) * 1461, 4) + self::div(153 * self::mod($gm + 9, 12) + 2, 5) + $gd - 34840408 - self::div(self::div($gy + 100100 + self::div($gm - 8, 6), 100) * 3, 4) + 752;
}