The traditional Japanese calendar consists of eras based on the reigning emperors. The imperial date format is required for some government documents and appl
You just have to use IntlDateFormatter::parse
:
format(strtotime('2012-01-01 Europe/Madrid'));
echo "Age in Japanese: $r\n";
$time = $formatter->parse($r);
$gregCalendar = IntlCalendar::createInstance('Europe/Madrid', 'ja_JP');
$gregCalendar->setTime($time * 1000);
$r2 = IntlDateFormatter::formatObject($gregCalendar, 'Gy');
echo "And back: $r2\n";
gives:
Age in Japanese: 平成24 And back: AD2012