I'm use Laravel 5.7, and I have set the date and time using strtotime (doesn't have a problem). My code:

{{ date('l', strtotime($job->date_start))}}

But what I need is just to change the name of the day into my language, if using the Carbon library it seems too sophisticated because all I need is to change the name of the day. Is there any way to solve what I need?

Thanks.

I expect the output like "Monday" to "Maandag" in Germany, or "Thursday" to "Jueves" in Spanish.

1 Answers

0
Davide Casiraghi On

The PHP function date() doesn't support any kind of translation.

With Carbon is quite easy:

{{Carbon\Carbon::parse($job->date_start)->isoFormat('dddd')}}

In this way you get an output according to the locale that is selected at the moment in your application.