Skip to content

Instantly share code, notes, and snippets.

@leben-jp
leben-jp / convDate2.php
Last active September 2, 2020 20:02 — forked from kazua/convDate2.php
PHPで西暦⇔和暦変換
<?php
function convGtJDate($src) {
list($year, $month, $day) = explode('/', $src);
if (!@checkdate($month, $day, $year) || $year < 1869 || strlen($year) !== 4
|| strlen($month) !== 2 || strlen($day) !== 2) return false;
$date = str_replace('/', '', $src);
if ($date >= 20190501) {
$gengo = '令和';
$wayear = $year - 2018;
}elseif ($date >= 19890108) {