علی آبادانی
Registered User
آقا این فایل تبدیل میلادی به شمسی ماست
تا دیروز کار میداد ولی امروز که میخوام خبر وارد سایت کنم ارور میده
ارور لاین 49
لطف میکنید راهنمایی کنید
تا دیروز کار میداد ولی امروز که میخوام خبر وارد سایت کنم ارور میده
ارور لاین 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;
}
}
?>
لطف میکنید راهنمایی کنید