0
The problem and the following, I am creating daily OS chart, only that comes from the bank with day in English, I would like to replace each index with the value in Portuguese My code
public function osSemanal($id_company)
{
$periodo = date("Y-m-d H:i:s", strtotime('-7 days'));
$sql = $this->db->prepare("select DAYNAME(dt_chegada) as dia, count(id) as os_gerada from os where id_company= :id_company
and dt_chegada >= :periodo group by DAYNAME(dt_chegada) order by dt_chegada");
$sql->bindValue(":id_company", $id_company);
$sql->bindValue(":periodo", $periodo);
$sql->execute();
$result = $sql->fetchAll(PDO::FETCH_OBJ);
foreach ($result as $res):
$dados[$res->dia] = $res->os_gerada;
endforeach;
echo json_encode($dados);
}
Comes from the bank:
[0]
"dia"=> "Friday",
"os_gerada"=> 1
[1]
"dia"=> "Sunday",
"os_gerada"=> 4
Is generated:
"Friday" => 1,
"Sunday" => 4
Expected result:
"Sexta" => 1,
"Domingo"=> 4
And how are you riding this
array
?– Marcelo de Andrade
Possible duplicate of How to make the date() function format a date in English?
– Marcelo de Andrade
@Marcelodeandrade does not see as duplicate, because he does not want to translate a date, in fact he wants to translate a string that is the key of the array, regardless if it is day of the week or other word.
– arllondias
As he described it, it is related to date. Even if it is in full, it is still a date.
– Marcelo de Andrade
forgot, posted code, take a look now
– Junior Ramoty