I keep getting number instead of month name. I need to get the month name like July.
$formatter = new \IntlDateFormatter(
"fa_IR@calendar=persian",
\IntlDateFormatter::FULL,
\IntlDateFormatter::FULL,
'Asia/Tehran',
\IntlDateFormatter::TRADITIONAL
);
$time = new \DateTime();
$formatter->setPattern('yyyy mm dd');
$formatter->format($time)
You can use MMMM.
All available pattern is on this link
$formatter = new \IntlDateFormatter(
"fa_IR@calendar=persian",
\IntlDateFormatter::FULL,
\IntlDateFormatter::FULL,
'Asia/Tehran',
\IntlDateFormatter::TRADITIONAL
);
$time = new \DateTime();
$formatter->setPattern('yyyy MMMM dd');
$formatter->format($time)
This question is same as this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With