I want to change the date format which is fetched from database.
now I got 2016-10-01{{$user->from_date}}
.I want to change the format \'d-m-y\' in laravel
In Laravel you can add a function inside app/Helper/helper.php like
function formatDate($date = '', $format = 'Y-m-d'){
if($date == '' || $date == null)
return;
return date($format,strtotime($date));
}
And call this function on any controller like this
$start_date = formatDate($start_date,'Y-m-d');
Hope it helps!