« Back to profile of amzain83

    						<?

		$month_to_convert    = gmdate("m",$date_to_convert);
		$year_to_convert     = gmdate("Y",$date_to_convert);
		$day_to_convert      = gmdate("d",$date_to_convert);
		$day_name_to_convert = gmdate("D",$date_to_convert);
		$hour                = gmdate("H",$date_to_convert);
		$minute              = gmdate("i",$date_to_convert);
		$second              = gmdate("s",$date_to_convert);
		
		// تعريب يوم الاسبوع
		if ($day_name_to_convert=="Sat") $day_name_to_convert="السبت";
		if ($day_name_to_convert=="Sun") $day_name_to_convert="الأحد";
		if ($day_name_to_convert=="Mon") $day_name_to_convert="الاثنين";
		if ($day_name_to_convert=="Tue") $day_name_to_convert="الثلاثاء";
		if ($day_name_to_convert=="Wed") $day_name_to_convert="الأربعاء";
		if ($day_name_to_convert=="Thu") $day_name_to_convert="الخميس";
		if ($day_name_to_convert=="Fri") $day_name_to_convert="الجمعة";

		If ($month_to_convert == 1 || $month_to_convert == 2)
		{
			$year_to_convert  = $year_to_convert - 1;
			$month_to_convert = $month_to_convert + 12;
		}
		
		// الداله تعطي الناتج بدون ارقام عشريه
		// عدد الايام منذ بدء التاريخ الميلادي الى هذا التاريخ
		$sum_days = intval(365.25  * $year_to_convert) 
		            + 
					intval(30.6001 * ($month_to_convert + 1)) 
					+ 
					                 ($day_to_convert + 1720994.5);
		
		// حساب الايام في السنوات الكبيسه 
		If (date("d / m / Y",$date_to_convert) >= (15 / 10 / 1582))
		{
			// متغير يساوي عدد مرات مرور 100 سنة
			$counter_evre_100_years = intval($year_to_convert / 100);
			$days_in_negative_years = 2 - $counter_evre_100_years + intval($counter_evre_100_years / 4);
			// حساب مجموع الايام النهائي بعد طرح الايام الكبيسه منه
			$sum_days = $sum_days + $days_in_negative_years;
		}
		// الايام بالهجري
		$sum_days_between_m_and_hejri = $sum_days - 1948437.5;
		
		$year_to_convert    = ($sum_days_between_m_and_hejri / 354.3667);
		$year_hejri_result  = intval($year_to_convert) + 1;
		
		$month_to_convert   = (12 * ($year_to_convert - intval($year_to_convert)));
		$month_hejri_result = intval($month_to_convert) + 1;
		
		$day_to_convert     = (29.5305 * ($month_to_convert - intval($month_to_convert)));
		$day_hejri_result   = intval($day_to_convert);
		
		If ($day_hejri_result == 0) 
		{
			$day_hejri_result   = 30;
			$month_hejri_result = $month_hejri_result - 1;
		}
		
		If ($month_hejri_result == 0 ) 
		{
			$month_hejri_result = 12;
			$year_hejri_result  = $year_hejri_result - 1;
		}

		if($sho_time==1)
		{
			$hour = $hour+3;
			$sho_time = "$hour:$minute:$second";
		}
		$date_result = "$day_name_to_convert $sho_time | $day_hejri_result/$month_hejri_result/$year_hejri_result هـ";
 
?>
    			         

    1 comments

  • OxYgEn says :

    nice work bro

Add comment
To add a comment, please : Login or Sign up
    amzain83
    أحمد محمد زين العابدين عبد الحميد سليمان
  • New visitor?

    On setCode, you can save your codes, functions and classes, you can also share them with your friends, and track your favorite developer

    Join the SetCode community
  • Your language here :