??? ???? ?????? ??????

????? ??????? ??????
Hijri Date 2.3.2

????? ??? ??????? ??????? ??? ???? ???? ???? ??? ????? ??? ?????.
.????? ?? ?? ??? ??? ???? ????? ?? ?????? ???? ??????.
??? ??? :
???? ???? ??????? ??????? ?? ?????? ?????? ???? ??? ????? ???? ??????? ???????? ???? ????? ?? ??? ?????? ?????? ?????. ???? ???? ?? ???? ???? ????? ????????

??????? ???????? ??????

??????? ??????(?????? ??? ??????? ???????? ???????? ????????) ?? ????? ???? ????? ??? ?????? ????? ????? ????? ?????? ?????? ??? ????? ?? ???? ?????? ??? ???? ?????? ??????.
??? ??? ?????? ??? ????? ??? ???????? ???? ?????? ??? ???? ??? ????? ??? ???? ?????:{?? ??? ?????? ??? ???? ???? ???? ?? ???? ???? ??? ??? ??????? ??????}. ??? ??? ????? ????? ?????? ?? ????? ????? ?? ??? ????? ?? ??? ???? ?? ?????.
??? ??? ??????? ??? ??????? ??? ?? ?? ???? ?? ????? ?????? ???????? ????? ??????? ?????? ????? ??? ?? ?? ???? ?? ??? ?? ?????? ?? ??? ?????? _??? ???? ???? ???? ??? ????- ?????? ??? ??? ?????? ??? ???? ??? ????? ?? ????? ??? ?? ??????.
?? ??? ??????? ??? ?? ?????? -??? ???? ???- ????? ?? ?????? ?? ??? ????? ??????? ?? ???????? ???? ?? ?????? ?? ????? ???? ???? ???? ???? ???? -??? ???? ???? ???? ??? ????- ?? ??? ??? ???????? ??? ??? ???? ????? ?????? ?? ??? ???? ??? ???????? ???? ????? ????? ??? ?? ??? ?????? ??? ????? ?? ??? ????? ????? ??? ??? ??????? ???????? ???????.

??? ???? ??????? ??????

???? ??????? ?????? ?????? ??? ?????? ??????? ??????? ??? ??? ????? ??????? ??? ?????? ?? ????? ??????? ?? ??? ???? ?????? ?????? ????? ?? ?????? ???????? ??? ???????? ?????? ???? ??????? ??????? ????? ??? ????? ?????? ??????? ???? ????? ?????? ????? ????? ?? ????? ??????? ?????? ? ?????? ?? ??????? ??????? ??? ???? ??? ??????? ???????? ?????? ?????????.

??????? ?????? ?????????

???? ??????? ?????? ????????? ??? ????? ??? ?????? ??????? (???? ?? ???? ?????? 2 ???? ????) ??30 ???? ??????? ??????? (???? ???? ?????? ??? 2 ???? ????) ??29 ???? ????? ???? ?????? ??? ??????? ??????:
30 29 30 29 30 29 30 29 30 29 30 29
???? ??? ????? 354 ???? ????? ?????? ???????? ???? ??? ??? ????? ??????? ??????? ???? ?????? ???? ????? ??? (0.36667) ?? ??? ??????? ??? ??????? ?? ???? ??? ?????? ???? ?? ??? ?? ????? ?? 11 ??? ?? ?? 30 ??? ????? ????? ??????? ????? ????? ?????? ???? ??? ???????:
30 29 30 29 30 29 30 29 30 29 30 30
????? ??? ??? ????? 355 ????? ???????? ??? ?? ???? ??? ?????? ????? ?? ?? 30 ???:
2 5 7 10 13 15 18 21 24 26 29
??????? ??? ?????:
?? ??? ?? ?? ?? ???? ** ??? ???? ??? ?????
?????? ??????? ?? ???? ????? ???? ?? ??? ?????. ????? ???? ??????? ???? ??????? ???????? ?????? ?????????? ??? ????? ????? ?????? ??? ???? ?????? ???? ???? ?????? ??????? ?? ?????.
????? ????? ??????? ?????? ??????? ???? ???? ??????? ????????? ???? ??? ???? ??????? ?????? 1-1-1?? ????? ?????? 15-7-622 ???? ??????? ?????????. ???????? ??????? ?? ????? ??????? ?????? ?????? ?????? ??????? ?????? ?????? ?? ????? ?????????? ?????? ?? ??????? 3.1? ??????? ????? ????? ????? ?????? ?????? ?????? ???? ???????

????? ?? ?????

?? ??????? ?????? ??????? ??????? ???????? ???? ??? ???? ????? ??? ?????? ????? ???? ??????? ???? ?????? ?? ??? ???????? ???????? ?? ??? ??????? ????? ????? ????????? ?????? ????????? ????? ?????? ???????? ?? ???? ??????? (http://www.ummulqura.org.sa/) ????? ?? ?? 1318 ??? 1500.
??? ???? ????? ???? ?? ????? ??? ????? ??????? ?????? ???? ????? ??????? ???? ???????? ???????? ?? ???? ????? ?? ????? ?? ?????? ?? 1318-1500? ???? ??? ??????? ?????? ???? ??? ?????? ??? ??????? ???? ??????? ???? ??????? ????????? ??????? ?????.

??????? ?? php

????? ??????? ?? Php ??? ??????? ????????? ??? ????? ?? ????? ??????? ????? ??? ?? ????? ?? ?????? ??????? ???????? ????????? ??????? ?? ???? ?? ?????? ?? ????? ???? ??? ??? ??????? ?? ?????? ??? ???? ???? ?????? ??? ????.
??? ??? ??????? ?????? ??? 1582 ?? ??????? ????????? ???? ????? ?? ??? ???? ?????? ??? 4 ???? ??? ??? ?????? ?? ??? ?????? ?????? ?????? ????? ????? ????? ?? ??? ???? ?????? ??? 4 ???? ??? ???? ??? ???? ??? ????? (??? 1900) ??? ??? ????? ???? ?????? ??? 400 ???? ??? (??? 2000)? ???? ????? ?? ??? 1582 ?? ????? ???? ??? ??? ?????? ???????? ??? ???? ??? ???? ?? ????? ??? 1918?.
???? ??? php ?? ??????? ????????? ???? ?? ??? ??? 1582 ? ??? ????? ?? ????? ?? ????? ?????? ??? 1582?.
????? ?? ??????? 5.2 ?? php ?? ????? ???(????) ???? ???? datetime ???? ??? ?????? ???? ???????? ??????? ??????? ?? ?????? ?????? ??????? ?????? ????. ??? ?????? ???? ??????? ?? php ???? ?? ??????? 5.3.

??????? ?????? ??????? ??????

????? ??????? ??? ????? ??????(?????):
?????? datetime: ????? ????? ??? ?????? ?????? ???? ????? ?? ??? Php ?????? ??????? ?????? ?? ??????? ???????? ?? ????? ???? ???? ??? ??????? (???????) format? ??? ???? ?????? ??????? ?? ???? datetime ??????? ??? ??????? ??????? ???? ?????? ?????? ??? ?????? ??????.
?????? Calendar: ?????? ??? ???? ???? ???????? ??? ??????? ?????? ????????? ?????? ????????? ??? ???? ??????? ???? calendar ?? ??? php.
?????? CalendarAdjustment: (???? ?? ??????? 2.1) ?????? ??? ???? ?????? ?????? ??????? ?? ????? ?? ????? ????? ?????? ?????? ???????.

??????? ???????:

????? ??? ????? ??????? ?????? ??? ??????? 5,3 ??? ????? ?? php.

?????? ???????

  • ??????? ????????? ?? ??????? ????? ????? ??????? ???????? ???? ??? ???????? ?????? ??????? ??? ???? ?????????? ?? ???? ???????? ?????? ????? ????? ?????? ?????? ???? ???????? ????? ??? ???????? ???????? ?????? ar-php ??????? ???? ?????? ???? ????? ???? ??????? ??? ???.
  • ????? ?? ????? ????? ?????? ?? ????? 100%.
  • ??????? ??? ???????? ??????? ??? ??????? ???? ?????? ?? ????? ????? ???????? ???? ???? ???? ??? ??? ????????? ????? ????? ???? ?? ?? ??? ?? ????? ???? ???? ???? ??????? ??? ??? ????.
  • ????? ??? ????????? ???????? ??????? ?? ??? ???? ?? ??????? ??? ???? ?????.
  • ??????? ??? ???? ??????? ?? ???? date ??? ?????? _ ?????.
  • ??????? ????? datetime ???? ???? ???? ???? ??????? ???????.
  • ??? ??????? ???????? ?????? ??????? ?? ???? ????????.
  • ??? 20 ??? ?????? ?? ????? ?????? ???????.

?????? ?????? ????? ????????

????? ??? ????? ??? ??????? ?? ??? php ????:
<?php
			require_once('hirji.class.php');
??? ??? ??? ??????? ?? ???? ??? ??? ?? ????.
???? ????? ????? ???????:
echo (new hijri\datetime());
????:
8 ????? 1436??
???? ??????? ?????? ?? ????????:
echo (new hijri\datetime())->format('D _j _M _Y?? (j-m-Y?)');
????:
???????? 8 ????? 1436?? (26-05-2015?)
???? ????? ??? ?????? ???? ???????:
echo (new hijri\datetime("2015-5-22"))->format('D _j _M _Y?? (j-m-Y?)');
????:
?????? 4 ????? 1436?? (22-05-2015?)
???? ????? ??? ???? ????:
$d=hijri\datetime::createFromHijri(1436,9,1);
echo $d->format('D _j _M _Y?? (j-m-Y?)');
????:
?????? 1 ????? 1436?? (18-06-2015?)

????????? ?????? ???????

???? ??? ????????? ?????? ??????? ??? ??????? ?? ????? ?????? (array) ???? $hijri_settings ???? ???? ????:
$hijri_settings=array(
	'langcode'=>'ar',
	'defaultformat' => '_j _M _Y??',
	'umalqura' => TRUE,
	'adj_data' => array(1426 => 57250, 1474 => 58668,),
	'grdate_format' => 'j M Y',
	);
?????? ??? ????????? ??????:
  • langcode ???? ??? ????? ??????? ?????? ????????? ??????? ?? 'ar' ???????, ?????? ?????? ?????? ???? ??????? ???? ?????????? ??????? ????????? ?? 'ar'
  • defaultformat ?????? ?????????? ???????? ??? ???? ??? ?????? ???? ????? ?????? ??? ??? ?????? ???? ?????? ??????? ????????? ?? '_j _M _Y??'
  • umalqura ???? ?? ??? ??? ???? ?????? ??? ???? ????? ?? ?????? ????? ??????? ?? TRUE ???????? ????? ?? ?????? FALSE ???????? ??????? ?????????? ?????? ?????????? ?? TRUE.
  • adj_data_source????? ??? ??????? ??? ?????? (array) ???? ????? ???? ????? ????????? ??? ????? ?? ????? ??????: (???? ?? ??????? 2.1)
  • adj_data (???? ?? ??????? 2.1) ?????? ??? ?????? ????????? ???? ?? ???? ???? ??? ?? ?????? ????? ?????? ????? ??? ?????? get_txt_adjdata() ??????? ?????? CalendarAdjustment.
  • grdate_format (???? ?? ??????? 2.1) ???? ??????? ??? ??????? CalendarAdjustment ???? ???? ?????? ???? ??? ??? ????? ???????? ??????????.
???????? ????? ??????? ???? (langcode, defaultformat) ??? ???? (????) datetime? ??????? ??????? ??? ????? calendar? ????? ??? ??????? ???? calendar ???? ????? ??? ????? ???? ???? ?? ?????.

???? ???? datetime

????? ???? datetime ??? ???? ???? ?????? datetime ?? ??? php ?? ????? ?? ??? ???? ??????? ????? format ?????? ?????? ??? createfromHijri ?setDateHijri ???? ??? ?????? ??????? ????????:

???? ??????? DateTime::__construct

???? ?????? ?????? ??? ?????? datetime.
??????? ?????? ??? ??:
public DateTime::__construct ([ string $time = "now" [, DateTimeZone $timezone = NULL [, string langcode = NULL [, hijri\Calendar Hcal =NULL]]]] )
??? ????????? ????????:
  • langcode ???? ??? ??? ??????? ??? ?? ????? ????? ????? ??????? ?? ????? $hijri_settings? ???? ?? ??? ????? ??????? ?? ??? ??????? ????? ??? ??????? ????????. ????? ??????? ?? 'ar' ??????? ????? ?????? ??? ?????? ????? ??????????
  • Hcal ???? ???? calendar ???? ???? ??????? ???? ???? ?? ??? ?????? ?????? ????? ???? ???? ?????????? ?????????? .
???? ????? ???? datetime ?????? ???????:
$d=hijri\datetime(NULL,NULL,'ar');
???? ????? ???? datetime ?????? ????? ??? ??????? ?????? ?????????:
$d=hijri\datetime(NULL,NULL,'ar', new hijri\Calendar(['umalqura'=>FALSE,]));

???? ??? ??????? ?????? datetime::format()

???? ?????? ?????? ????? ???????? ?????? ????? ??? ???? ?????? ?? ??????? ?????? ???? ???????? ?? ??? ??? ?????? ????????? ?? ??????? ??? ???????:
????? ????? ???? ??? ???????
??? ??????? ?????? ?? ?? ??????
_j ????? ???? ????? ?????? 1-30
_d ??? ?? ????? ?????? 01-30
S ????? ??????? ????????? ?? ????? ?????????? ???? ?? ???? ?????? ????? ?????????? ??? (???? ?? ??????? 2.3) st-nd-th
_z ??? ????? ?? ????? ????? ?? ????? 0-354
_M,_F ??? ????? ????? ????..
_m ??? ????? ?? ????? ?????? 01-12
_n ??? ????? ???? ????? ?????? 1-12
_t ??? ?????? ?? ????? 29-30
_L ????? ????? ?? ?? 1=?????? 0=???? ?????
_Y ????? ??? ???? 1436
_y ????? ?? ????? 36
????? ??? ???? ??? ??????? ???????? ?? ???? ?????? ????? ???????
l, D ??? ??? ??????? ?????? ?????...
F ????? ?????? ????????? ???????? ????????? ????? ??????? ???? ...
M ????? ?????? ????????? ???????? ?????????? ?????? ?????? ...
a ????? ?? ? ?-?
A ????? ????? ????? -????
????:
echo (new hijri\datetime())->format('D _j _M _Y?? (j-m-Y?)');
????:
???????? 8 ????? 1436?? (26-05-2015?)

?????? datetime::CreateFromHijri()

???? ??? ?????? ?????? ???? datetime ?? ????? ???? ??? ???? ?? ??? static ????? ??? ?? ????? ??? ????? ???????:
static CreateFromHijri(int year,int month, int day)
???????? ?? ????? ? ????? ?????? ??? ???????
????:
$d=hijri\datetime::createFromHijri(1436,9,1);
echo $d->format('D _j _M _Y?? (j-m-Y?)');
????:
?????? 1 ????? 1436?? (18-06-2015?)
???? ?? ??? ?????? ?? ???? ???? ??????? ?????? ?? ?? ???? ?? ?? ?? ???? ?????? ?? ????? ?? ??? ???? ???? ?? ????? ???? ??? ???? ???? ????? ???? ??? ??? ???? ????:
function get_before_month($year,$month,$day)
			{
				return \hijri\datetime::createFromHijri($year,$month-1,$day);
			}
			echo get_before_month(1436,1,10);
?????? ?????:
10 ?? ????? 1435??

?????? setDateHijri

???? ?????? ??? ??????? ?? ?????? ??? ??????? ??????:
 seDateHijri(int year,int month, int day)
???????? ?? ????? ?????? ?????? ??? ???????.
????:
$d=new hijri\datetime();
	echo $d;
	echo  '
'; $d->setDateHijri(1436,9,1); echo $d;
??????:
9 ????? 1436??
1 ????? 1436??
???? ?????? ???????? ?? ???? ???? ??????? ????? ?????? ??? ????? ?? ?????.

???? ?????? hijri\calendar

??? ?????? ???? ?????? ???? ???? ????? ?????? ??????? ???? calendar ?? ??? php ?? ???? ???? ?? ?????? ???? ??????? ??????.

???? ??????? calendar::__construct()

???? ?????? ?????? ???? calendar ???? ?? ??? ??? ??????? ?????? ??.
??????:
calendar::__construct( array settings=array())
settings ????? ?? ??? ?????? ????? ??? ??????? ??????? ??? ??? ????????? ???? ?? ????? ?????.
????:
$c=new hijri\Calendar(array(
		'umalqura'=> TRUE,
		'adj_data' => '1426 => 57250, 1429 => 57339,',

	);
???? ??? ?????? ?????? ???? calendar ?????? ??? ????? ?? ????? ?? ????? ???? ?? ??? adj.txt ?? ??? ??????.

?????? jd2hijri()

???? ?????? ?????? ????? ????????? ??? ????? ????.
JD2hijri(int julianday,  int &hy, int  &hm, int &hd,  int &hz)
?????????: julianday ????? ?? ??? ??? ???? ????? ?????????. hy, hm, hd, hz ??????? ????? ?? ??? ??? ???? ?????? ?????? ??????? ?????? ?? ?????? ?????? ?? ????? ??? ?????? ??? ???????
????
$c=new hijri\Calendar();
	$c->jd2hijri(2450000, $hy,$hm,$hd,$hz);
	echo "????? ????????? 2450000 ????? $hd - $hm -$hy ?? ??????? ??????"; 
???????:
????? ????????? 2450000 ????? 15 - 5 -1416 ?? ??????? ??????

?????? HijriToJD()

???? ?????? ????? ????????? ?????? ???? ????
??????
HijriToJD(int month, int day, int year)
?????? ?????? ?? ????? ?????? ?????? ??? ???????
???? ?????? ?????? ????? ?????????
????:
$c=new hijri\Calendar();
	$j=$c->HijriToJD(1, 1, 1);
	echo "??? ??? ?? ??????? ?????? ????? ". jdtojewish($j) . "?? ??????? ??????? <br>";
	echo "??? ????? ". jdtojulian($j) . "?? ??????? ????????? <br>";
	echo "??? ????? ". jdtogregorian($j) . "?? ??????? ????????? <br>";
	echo "??? ????? ". jdtofrench($j) . "?? ????? ?????? ???????? <br>";
???????:
??? ??? ?? ??????? ?????? ????? 12/2/4382?? ??????? ??????? 
??? ????? 7/15/622?? ??????? ????????? 
??? ????? 7/18/622?? ??????? ????????? 
??? ????? 0/0/0?? ????? ?????? ????????

JDToHijri()

???? ???? ??? ?????? jd2hijri ?? ???????? ???? ???? ??????? ?????? ???/???/???.
????:
 echo (new hijri\Calendar())->JDToHijri(2450000);
???????:
5/15/1416

days_in_month()

???? ?????? ??? ???? ?????
??????:
 int days_in_month(int month, int year, bool umalqura=null)
????????: month ,year ????? ?????? ?????? ??????.
umalqura ???? ?? ??? ??? ???? ??????? ????? ?? ?????
????
echo (new hijri\Calendar())->days_in_month(9,1436);
??????:
29

leap_year()

???? ?? ??? ???? ????? ????? ?? ??
??????
 int leap_year(int year, bool umalqura=null)
year ??? ?????.
umalqura ????? ?? ??????? ????? ?? ?????. ??????? ???? 1 ????? ??????? ?0 ????? ???????

checkHijriDate()

???? ???? ??? ????? ????
??????:
bool checkHijriDate(int year, int month, int day)
???????? ?? ????? ? ????? ? ????? ? ??? ???????
????:
$hy = 1436; $hm= 9;$hd=30;
$c=new hijri\Calendar();
if($c->checkHijriDate($hy,$hm,$hd))
{
	echo "??????? $hd - $hm - $hy ???? ?? ????? ?? ?????";
}else
{
	echo "??????? $hd - $hm - $hy ??? ???? ?? ????? ?? ?????";
}
???????:
??????? 30 - 9 - 1436 ??? ???? ?? ????? ?? ?????

???? ??????? ??? ???????? GregorianToHijri, HijriToGregorian, JulianToHijri, HijriToJulian, WesternToHijri, HijriToWestern

???? ??? ????? ???????? ??? ???????? ?????? ????????? ?????????? ?????????? ???????? ?????? ???
array function(int year, int month, int day)
??? function ??? ?????? ????????? ?? ????? ?????? ?????? ??? ???????
????? ??????? ??? ??? ?????? ???????:
array(
'y' => ?????,
'm' => ?????,
'd' => ????? )
?????? ??? ?????? ??????
GregorianToHijri ????? ?? ??????? ????????? (??????? ?? ????? ?? ???? ?????) ??? ??????? ??????
HijriToGregorian ????? ?? ??????? ?????? ??? ????????
JulianToHijri ??????? ?? ??????? ????????? ???? ??? ????? ??? ??????? ????????? ??? 1582 ??????? ???? ????? ?? ??? ??????? ??????? ??? ??????? ??????
HijriToJulian ??????? ?? ??????? ?????? ??? ??????? ?????????,
WesternToHijri ??????? ?? ??????? ?????? ???????? ????? ?? ???? ?? ??????? ????????? ??? 1582 ???????? ????????? ??? 1582 ??? ??????? ??????.
HijriToWestern ??????? ?? ??????? ?????? ??? ??????? ?????? ????????
???? ??? ???? ??????? ??? ??????? ???????? ???????? ???????? ?????? ??????? ???????? WesternToHijri? HijriToWestern ??? ???? ??? ?????? ???????? ???????? ??? ????????? ????????? ??????????.
$c=new hijri\Calendar();
$m = $c->HijriToWestern(1436, 9, 1);
echo "????? ????? ?? ????? ??? ????? ".$m['d'] ."-". $m['m'] .'-'. $m['y']." ???????? ????????";
??????:
????? ????? ?? ????? ??? ????? 18-6-2015 ???????? ????????
???? ???:
$c=new hijri\Calendar();
$j = $c->JulianToHijri(2015, 12, 25);
$g=$c->GregorianToHijri(2015, 12, 25);
echo "????? ??? ??????? ??? ??????? ??????? ?????? ????? ??  ".$j['d'] ."-". $j['m'] .'-'. $j['y'].
		"<br> ??? ??????? ?????? ?? ".$g['d'] ."-". $g['m'] .'-'. $g['y'].
		"<br> ????? ". ($j['d']-$g['d']) . "???";
???????:
????? ??? ??????? ??? ??????? ??????? ?????? ????? ??  27-3-1437
 ??? ??????? ?????? ?? 14-3-1437
 ????? 13???

???? ?????? hijri\CalendarAdjustment

(???? ?? ??????? 2.1)

???? ?????? ?????? ????? ??????? ??? ????? ?? ?????? ??? ???? ????? ????? ????? ?????? ??? ??????? api ?????? ?????????? ???? ?????? ?? ??? adjuster.php ?? ???? examples.

??????? ???????? ?? ??? ???????

  • ??? ??? ???? ????? ???? ??? ???? ??????? ???? ???? ????? ??? ???? datetime ?? ????? ????? ???????? ??????? ??? ????? ??? ????? ?????? ??? php ???????? ??????? ???? ?? ?????? ??????:
    use hijri\datetime as datetime;
    ????? ???? ???? ????? ???? ?????? ???? ????? ??? ?????? ??? ????? ??? ????????? ??? ??????? $hijri_settings
  • ??? ??? ???? ????? ???? ????? ?????? ?????? date ??? ?????? ?????? datetime ??????? ????? ??? ??????:
    function hdate($format, $timestamp=NULL)
    {
    	if(!isset($timestamp)) {
    		$timestamp=time();
    	}
    	$d= new hijri\datetime('@'.$timestamp);
    	return $d->format($format);
    }
    ???????? ?????? date ?? hdate ???? ??? ??? ???? ??? ????????? PECL apd ??? ?????? ??? ?????:
    rename_function("date","php_date");
    ????? ?????? ??????? ???? date.
  • ???? ???adjuster.php ?? ???? examples ???? ???? ????????? ?? ????? ?? ????? ???? ??? ??? ????? ?????? ????? ???? ??? ?? ??????? ???? ???? ?? ???? ???????? ??? ????? ??? ????? ???? ??? ?? ??? ????????? ??? ??? ????????? ????? ?? ?? ????? ??? ?????? ?? ???? ???? ????? ????.