- var_dump: documentation ( source)
- date: documentation ( source)
- mb_ereg_replace: documentation ( source)
<?php
$formatter = new IntlDateFormatter(
'ja_JP@calendar=japanese',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Madrid',
IntlDateFormatter::TRADITIONAL,
'Gy年M月'
);
$str = "令和元年8月";
$new = mb_ereg_replace($str , "令和元年" , "2019年");
echo $new;
$ts = $formatter->parse($new);
//$ts = $formatter->parse('令和元年8月');
var_dump($ts, date('Y-m', $ts));