いま平成何年?西暦和暦の年や干支日付け表示

西暦和暦月日付け干支を表示させる(http://patareru.net/nen/index.php)

今日の日付

$today = getdate();
$year = $today[year];
$eto = array(“子(ねずみ)”,”丑(うし)”,”寅(とら)”,”卯(うさぎ)”,”辰(たつ)”,”巳(み)”,”午(うま)”,”未(ひつじ)”,”申(さる)”,”酉(とり)”,”戌(いぬ)”,”亥(い)”);
$eto1 = $eto[($year % (12-4))];
if ($year >= 1989){
echo “平成”.($year-1988).”年(干支 $eto1 どし)
“;
} elseif (1926 <= $year and $year <= 1988){
echo “昭和”.($year-1925).”年(干支 $eto1 どし)
“;
} elseif (1912 <= $year and $year <= 1987){
echo “大正”.($year-1911).”年(干支 $eto1 どし)
“;
} else {
echo “明治”.($year-1867).”年(干支 $eto1 どし)
“;
}
print(” (西暦 $today[year]年)$today[mon]月$today[mday]日”);
//曜日番号に対応する日本語の曜日リスト
$weekjp_array = array(‘日’, ‘月’, ‘火’, ‘水’, ‘木’, ‘金’, ‘土’);
//今日の曜日
$weekno = date(‘w’);
$weekjp = $weekjp_array[$weekno];
echo “($weekjp)曜日 “;
?>
参考
干支を求める