0
I created this date function to show the date, day and month.
The problem is that it shows the més in English..
exemplo: March, 10, 2018".
How do I make him read in Portuguese?
function dateName($date) {
$result = "";
$convert_date = strtotime($date);
$month = date('F',$convert_date);
$year = date('Y',$convert_date);
$name_day = date('l',$convert_date);
$day = date('j',$convert_date);
$result = $month . " " . $day . ", " . $year;
return $result;
}
Just to contribute a little bit, research on Carbon, it solves this very well. I’m not saying USE, I’m saying to know the tool and suddenly pick up ideas by reading the source code.
– David Dias
Sometimes I don’t understand, whether this is to help or just another unanswered Forum.
– user21312321
Your answer is here https://answall.com/questions/8317/como-fazer-a-fun%C3%A7%C3%A3o-date-formatar-uma-data-em-portugu%C3%Aas
– David Dias
I might have been there, but since I put that in the code.....
– user21312321
Try to insert this at the beginning of your function:
setlocale(LC_TIME, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
– David Dias