@Formatink try this
Carbon::setLocale('fr')->now()->format('l j F Y H:i:s');
or if you want to leverage the app.locale key then you can do
Carbon::setLocale(config('app.locale'))
Hope I could help.
Hello,
I would like to use the localisation of Laravel, which is set in the app.php file, for Carbon.
I tried but it does not work. (config/app.php)
<?php
...
'locale' => 'fr',
...
(routes.php)
<?php
echo Carbon::now()->format('l j F Y H:i:s');
echo (string) (new Carbon($news[0]->created_at))->formatLocalized('%A %d %B %Y'); // this instruction works with setlocale(LC_TIME, 'French');
?>
These two instructions return the date in English (instead of French) despite the configuration of "local" on "fr".
Can you help me ? Thank you in advance.
Regards, Formatink
Please or to participate in this conversation.