I am using this code to get Arabic Date.
$DateTime = new DateTime();
$IntlDateFormatter = new IntlDateFormatter(
'en_US@calendar=islamic-civil',
IntlDateFormatter::MEDIUM,
IntlDateFormatter::MEDIUM,
'Europe/London',
IntlDateFormatter::TRADITIONAL );
echo $IntlDateFormatter->format( $DateTime );
I am getting result Muh. 4, 1445 AH, 4:01:56 PM
. But I need date 4 Muharram 1445
.
So this should work:
<?php
$DateTime = new DateTime();
$IntlDateFormatter = new IntlDateFormatter(
'en_US@calendar=islamic-civil',
IntlDateFormatter::NONE, // No date format, as we'll specify the pattern manually
IntlDateFormatter::MEDIUM, // Use default time format
'Europe/London',
IntlDateFormatter::TRADITIONAL
);
// Set the custom pattern for the date
$pattern = "d MMMM y";
$IntlDateFormatter->setPattern($pattern);
echo $IntlDateFormatter->format($DateTime);
the $pattern = "d MMMM y";
is the cause