[Typo3] converting the date
"Jesús H."
cyNOSPAM at ya.com
Sat Mar 26 13:31:31 CET 2005
Hi Ahmad,
If all this doesn't work, I've created a little PHP code for the
conversion of date format to Hijra for a custom project that may help
you. If you develop an extension, please make it available for other
users like you.
Here is the function I did:
unction hijra($day,$month,$year) {
if
(($year>1582)||(($year==1582)&&($month>10))||(($year==1582)&&($month==10)&&($day>14)))
{
$jd=intval((1461*($year+4800+intval(($month-14)/12)))/4)+intval((367*($month-2-12*(intval(($month-14)/12))))/12)-intval((3*(intval(($year+4900+
intval(($month-14)/12))/100)))/4)+$day-32075;
}
else
{
$jd =
367*$year-intval((7*($year+5001+intval(($month-9)/7)))/4)+intval((275*$month)/9)+$day+1729777;
}
$l=$jd-1948440+10632;
$n=intval(($l-1)/10631);
$l=$l-10631*$n+354;
$j=(intval((10985-$l)/5316))*(intval((50*$l)/17719))+(intval($l/5670))*(intval((43*$l)/15238));
$l=$l-(intval((30-$j)/15))*(intval((17719*$j)/50))-(intval($j/16))*(intval((15238*$j)/43))+29;
$month=intval((24*$l)/709);
$day=$l-intval((709*$month)/24);
$year=30*$n+$j-30;
// Weekday calculation (Monday, Tuesday...)
$wdn=$jd%7;
if($wdn==0){$weekday = "Monday, ";}
elseif($wdn==1){$weekday = "Tuesday, ";}
elseif($wdn==2){$weekday = "Wednesday, ";}
elseif($wdn==3){$weekday = "Thursday, ";}
elseif($wdn==4){$weekday = "Friday, ";}
elseif($wdn==5){$weekday = "Saturday, ";}
elseif($wdn==6){$weekday = "Sunday, ";}
else {$weekday = "";}
// Month calculation and dump
if($month==0){$month = "Monday, ";}
elseif($month==1){$month = "Muharram";}
elseif($month==2){$month = "Safar";}
elseif($month==3){$month = "Rabi I";}
elseif($month==4){$month = "Rabi II";}
elseif($month==5){$month = "Jumada I";}
elseif($month==6){$month = "Jumada II";}
elseif($month==7){$month = "Rajab";}
elseif($month==8){$month = "Sha'ban";}
elseif($month==9){$month = "Ramadan";}
elseif($month==10){$month = "Shawwal";}
elseif($month==11){$month = "Dhu'l-Qa'dah";}
elseif($month==12){$month = "Dhu'l-Hijja";}
else {$month = "";}
echo ($weekday . $day . ' ' . $month . ' ' . $year);
}
Regards,
Jesús H.
ahmad wrote:
> Hi Stanislas
>
> Thank you for your attention .
>
> That is not only a format , it is a separate calendar date at all , we are now in 1384-01-06 :)
>
> Goodluck
>
>
> - ahmad (ahmad)
>
> -----------------------
> This thread is located in the archive at this URL:
> http://typo3.org/documentation/mailing-lists/english-main-list-archive/thread/110115680/
>
More information about the TYPO3-english
mailing list