برگزیده های پرشین تولز

سوال فوری در مورد miladi to shamsi

علی آبادانی

Registered User
تاریخ عضویت
30 اکتبر 2006
نوشته‌ها
898
لایک‌ها
11
محل سکونت
Abadan
آقا این فایل تبدیل میلادی به شمسی ماست
تا دیروز کار میداد ولی امروز که میخوام خبر وارد سایت کنم ارور میده
ارور لاین 49

PHP:
<?php
	class miladiToshamsi
	{
		 var  $sM;
		 var $sD=99;
		 var $sY;
		 var $datestr;
		// $yearmonth;
		
	function convertmiladishamsi($Year,$Month, $Day)
	{
		if(($Year / 4)==0) 
				$cabisah=1;
             else 
				$cabisah=0;

           if((($Year-1) / 4)==0 )
			   $offset=1;
           else $offset=0;
			

switch ($Month){
  case 1: {
         if ($Day<=(20-$offset))
		   {
              $this->sM=10;
              $this->sD=$Day+10+$offset;
              $this->sY=$Year-622;
            }
      else
         {
            $this->sM=11;
            $this->sD=$Day-(20-$offset);
            $this->sY=$Year-622;
         }
	  break;
    }
    case 2: {
		if ($Day<=(19-$offset))
		{
			$this->sM=11;
			$this->sD=$Day+11+$offset;
			$this->sY=$Year-622;
		}
		else
		{
			$this->sM=12;
			$this->sD=$Day-(19-$$offset);
			$this->sY=$Year-622;
		}  
		  break;
}
   
   case 3: {
        if ($Day<=(20-$cabisah)) 
            {
              $this->sM=12;
              $this->sD=$Day+9+$offset+$cabisah;
              $this->sY=$Year-622;
            }
      else
         {
            $this->sM=1;
            $sD=$Day-(20-$cabisah);
            $this->sY=$Year-621;
         }
	     break;
    }
   case 4: {
        if ($Day<=(20-$cabisah)) 
            {
              $this->sM=1;
              $this->sD=$Day+11+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=2;
            $this->sD=$Day-(20-$cabisah);
            $this->sY=$Year-621;
         }
	     break;
    }
    case 5: {
      if ($Day<=(21-$cabisah)) 
            {
              $this->sM=2;
              $this->sD=$Day+10+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=3;
            $this->sD=$Day-(21-$cabisah);
            $this->sY=$Year-621;
         }
		  break;
    }
    case 6: {
    if ($Day<=(21-$cabisah))
            {
              $this->sM=3;
              $this->sD=$Day+10+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=4;
            $this->sD=$Day-(21-$cabisah);
            $this->sY=$Year-621;
         }
		  break;
    }
    case 7: {
    if ($Day<=(22-$cabisah))
            {
              $this->sM=4;
              $this->sD=$Day+9+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=5;
            $this->sD=$Day-(22-$cabisah);
            $this->sY=$Year-621;
         }
		  break;
    }
    case 8: {
    if( $Day<=(22-$cabisah))
            {
              $this->sM=5;
              $this->sD=$Day+9+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=6;
            $this->sD=$Day-(22-$cabisah);
            $this->sY=$Year-621;
         }
		  break;
    }
    case 9: {
    if ($Day<=(22-$cabisah))
            {
              $this->sM=6;
              $this->sD=$Day+9+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=7;
            $this->sD=$Day-(22-$cabisah);
            $this->sY=$Year-621;
         }
		  break;
    }
  case 10: {
    if ($Day<=(22-$cabisah))
            {
              $this->sM=7;
              $this->sD=$Day+8+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=8;
            $this->sD=$Day-(22-$cabisah);
            $this->sY=$Year-621;
         }
	  break;
    }
    case 11: {
    if ($Day<=(21-$cabisah))
            {
              $this->sM=8;
              $this->sD=$Day+9+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=9;
            $this->sD=$Day-(21-$cabisah);
            $this->sY=$Year-621;
         }
		  break;
    }
   case 12: {
    if ($Day<=(21-$cabisah))
            {
              $this->sM=9;
              $this->sD=$Day+9+$cabisah;
              $this->sY=$Year-621;
            }
      else
         {
            $this->sM=10;
            $this->sD=$Day-(21-$cabisah);
            $this->sY=$Year-621;
         }
	     break;
     }
	  
 
}

$datestr = $this->sY."/".$this->sM."/".$this->sD;
$Yearmonth= $this->sY+"/"+$this->sM;
//ECHO $sY;
return $datestr;
	}
function getDay()
	{
	
	return $this->sD;
	}
function getMonth()
	{
	
	return $this->sM;
	}	
	function getYear()
	{
	
	return $this->sY;
	}
	}
?>




لطف میکنید راهنمایی کنید
 

علی آبادانی

Registered User
تاریخ عضویت
30 اکتبر 2006
نوشته‌ها
898
لایک‌ها
11
محل سکونت
Abadan
ای بابا چرا کسی جواب ما رو نمیده
آقا یه اتفاق دیگه هم افتاد امروز که خواستم خبر سند کنم کار داد
فقط تو یه روزهای خاصی از ماه جواب نمیده و این ارور رو میده کسی نمیدونه چرا؟
 

firebird

Registered User
تاریخ عضویت
2 جولای 2005
نوشته‌ها
1,424
لایک‌ها
10
سن
46
خط 48 به نظر اون offset$$ يه دونه $ درسته.
 
بالا