xxxxxxxxxx
{{\Carbon\Carbon::createFromFormat('H:i:s',$time)->format('h:i')}}
{{$item->date_seance->format('d/m/Y') }}
{{date('H:i', strtotime($item->start_time)) }}
xxxxxxxxxx
//before
$data->created_at; // 2021-12-14 00:00:00
//after
$data->created_at->format('Y-m-d'); //2021-12-14
$data->created_at->format('H:i:s'); //00:00:00
xxxxxxxxxx
//laravel method 1
{{ $data->created_at->isoFormat('dddd D') }}
//laravel method 2
{!! date('d/M/y', strtotime($data->created_at)) !!}
xxxxxxxxxx
// in model
protected $casts = [
'date_of_approval' => 'date:d-m-Y'
];
// if you want change format any where
$appointment->date_of_approval->format('Y-m-d');
// if you have not cast in model data format
Carbon\Carbon::parse($appointment->date_of_approval)->format('Y-m-d');
xxxxxxxxxx
date('d-m-Y', strtotime($user->from_date));
/**
or
**/
date_format($user->from_date,'D M Y')
xxxxxxxxxx
$user = \App\User::find(1);
$newDateFormat = $user->created_at->format('d/m/Y');
dd($newDateFormat);