Blade.php
<tr>
<td class="lesDates">
<?php
$date = strtotime($formation['annee_obtention']);
echo date('D / M / Y ', $date);
?>
</td>
</tr>
I would like to show it in French long format.
Blade.php
<tr>
<td class="lesDates">
<?php
$date = strtotime($formation['annee_obtention']);
echo date('D / M / Y ', $date);
?>
</td>
</tr>
I would like to show it in French long format.
in laravel you can use Carbon to managing date or time in you application. check out this https://carbon.nesbot.com/docs/
in carbon,you can format the date using simple code. example in Carbon docs
// Let say Martin from Paris and John from Chicago play chess
$martinDateFactory = new Factory([
'locale' => 'fr_FR',
'timezone' => 'Europe/Paris',
]);
$johnDateFactory = new Factory([
'locale' => 'en_US',
'timezone' => 'America/Chicago',
]);
// Each one will see date in his own language and timezone
// When Martin moves, we display things in French, but we notify John in English:
$gameStart = Carbon::parse('2018-06-15 12:34:00', 'UTC');
$move = Carbon::now('UTC');
$toDisplay = $martinDateFactory->make($gameStart)->isoFormat('lll')."\n".
$martinDateFactory->make($move)->calendar()."\n";
$notificationForJohn = $johnDateFactory->make($gameStart)->isoFormat('lll')."\n".
$johnDateFactory->make($move)->calendar()."\n";
echo $toDisplay;
/*
15 juin 2018 12:34
Aujourd’hui à 12:40
*/
echo $notificationForJohn;
/*
Jun 15, 2018 12:34 PM
Today at 12:40 PM
*/
Use this Repository : https://github.com/jenssegers/laravel-date
To install this library you can follow these instructions: https://github.com/jenssegers/laravel-date#installation
Using a library as Laravel-Date you will just need to set the language of the app in the Laravel app config file and use its functions to format the date as you want.
Set the language in /app/config/app.php
'locale' => 'fr',
Examples:
use Jenssegers\Date\Date;
Date::setLocale('nl'); //Change this to your preferred locale
echo Date::now()->format('l j F Y H:i:s'); // zondag 28 april 2013 21:58:16
echo Date::parse('-1 day')->diffForHumans(); // 1 dag gelede
Hindi Example:
Date::setLocale('hi');
echo Date::now()->format('l j F Y H:i:s');
French Example:
Date::setLocale('fr');
echo Date::now()->format('l j F Y H:i:s');