strftime does not work locally

1

I have locally installed PHP, Mysql and Apache, however I'm trying to bring the day of the week through the code below:

setlocale(LC_TIME, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');

$mes = date('m', strtotime('2018-02'));
$ano = date('Y', strtotime('2018-02'));
$qtdMes = cal_days_in_month(CAL_GREGORIAN, $mes, $ano);

for($dias = 1; $dias < $qtdMes; $dias++){
    $diaSemana = utf8_encode(strftime("%A", strtotime($ano . '-' . $mes . '-' . $dias)));
echo "Dias da semana".$diaSemana;
}

The problem is that locally, it only brings me the first day and not the other days. I already installed locales as below, but it did not work:

apt-get install locales
dpkg-reconfigure locales

On the remote server it works normally, but not locally.

    
asked by anonymous 11.04.2018 / 14:58

1 answer

-1

I managed to resolve. I removed the utf8_encode() , thus:

setlocale(LC_TIME, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');

$mes = date('m', strtotime('2018-02'));
$ano = date('Y', strtotime('2018-02'));
$qtdMes = cal_days_in_month(CAL_GREGORIAN, $mes, $ano);

for($dias = 1; $dias < $qtdMes; $dias++){
    $diaSemana = strftime("%A", strtotime($ano . '-' . $mes . '-' . $dias));
echo "Dias da semana".$diaSemana;
}
    
11.04.2018 / 15:04