以下是一小段代码,用于获取正确转换的格里高利日期的字符串数据
<?php
$arDateFrench = gregorian2FrenchDateArray(11, 9, 1799) ;
echo $arDateFrench[1] . " " . $arDateFrench[0] . " " . $arDateFrench[2] ;
function gregorian2FrenchDateArray($m, $d, $y)
{
$julian_date = gregoriantojd($m, $d, $y);
$french = jdtofrench($julian_date);
if($french == "0/0/0")
return "" ;
$arD = split("/", $french) ;
$monthname = FrenchMonthNames($arD[0]) ;
$stryear = decrom($arD[2]) ;
return array($monthname, $arD[1], $stryear ) ;
}
function FrenchMonthNames($mo)
{
$arMo = array("葡月",
"霜月",
"雪月",
"雨月",
"风月",
"芽月",
"花月",
"草月",
"热月",
"果月",
"麦月",
"葡萄月",
"无裤汉节") ;
if($mo < count($arMo)+1)
return $arMo[$mo-1] ;
}
function decrom($dec){
$digits=array(
1 => "I",
4 => "IV",
5 => "V",
9 => "IX",
10 => "X",
40 => "XL",
50 => "L",
90 => "XC",
100 => "C",
400 => "CD",
500 => "D",
900 => "CM",
1000 => "M"
);
krsort($digits);
$retval="";
foreach($digits as $key => $value){
while($dec>=$key){
$dec-=$key;
$retval.=$value;
}
}
return $retval;
}
?>