0

I am trying to use IntlDateFormatter class to format the local time but it is giving error as PHP Fatal error: Uncaught Error: Class "IntlDateFormatter" not found. I tried to solve it by uncommenting the extension=intl in php.ini. So it did not work. My PHP version is 8.1.6. Here is the code:

    <?php

date_default_timezone_set('Europe/Madrid');
$script_tz = date_default_timezone_get();
$currentDay = date('D');   //$d = date(‘D’);
$formatter = new IntlDateFormatter('es_ES', IntlDateFormatter::FULL, IntlDateFormatter::NONE, 'Europe/Madrid', IntlDateFormatter::GREGORIAN);
$data1 = $formatter->format(time());



if(date('D') === 'Wed' && date('G') >= 14 && date('G') < 24){
    $content = "<h2><b>Estrazioni del Lotto e del Superenalotto di oggi ".$data1." in diretta: chi vincerà</b></h2>";
    echo $content;
}
    $data = array(
        //'post_content' => $leadContent,
    );
?>

1 Answers1

0

If you uncommented extension=php_intl.dll in your php.ini and it didn't work you can copy icu****.dll files (about five of them) from PHP folder to Apache /bin folder then restart Apache and try again.