©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PHP 4, PHP 5, PHP 7)
JDToFrench — 转变一个Julian Day计数到French Republican历法的日期
$juliandaycount
)转变一个Julian Day计数到French Republican历法的日期。
julianday
一个julian天数
以"月/日/年"形式的french revolution日期
[#1] pieterc dot depraetere at ugent dot be [2010-03-10 14:04:46]
If you want to convert a date later than September 22nd 1806, you could use this function. It's a bit crude and due to the fact the original function terminates in the middle of 1806, it uses 1805 as it's 'terminus post quem'.
<?php
function extended_jdtofrench ($juliandate) {
if ($juliandate > 2380945) {
// jdtofrench () only accepts dates until september 1806
$gregorian_date = jdtogregorian ($juliandate);
$temp = explode ('/', $gregorian_date);
$year = $temp[2];
$juliandate = gregoriantojd ($temp[0], $temp[1], 1805);
$republican_date = jdtofrench ($juliandate);
$republican_date = explode ('/', $republican_date);
$diff = $year - 1805;
$republican_date[2] = $republican_date[2] + $diff;
} else {
$republican_date = jdtofrench ($juliandate);
}
return $republican_date;
}
?>
[#2] squenz at titania dot bottoms-dream dot de [2006-04-06 08:25:53]
Here is a small piece of code to obtain the string data for a correctly converted gregorian date:
<?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) ;
// get the month name
$monthname = FrenchMonthNames($arD[0]) ;
$stryear = decrom($arD[2]) ;
return array($monthname, $arD[1], $stryear ) ;
}
function FrenchMonthNames($mo)
{
$arMo = array("Vend??miaire",
"Brumaire",
"Frimaire",
"Niv?se",
"Pluvi?se",
"Vent?se",
"Germinal",
"Flor??al",
"Prairial",
"Messidor",
"Thermidor",
"Fructidor",
"Sansculottide") ;
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;
}
?>
[#3] serged at noos dot fr [2003-10-28 09:00:12]