date format change in laravel blade

68

date('d-m-Y', strtotime($user->from_date));
/**
or
**/
date_format($user->from_date,'D M Y')
date('d-m-Y', strtotime($user->from_date));
// date('d-m-Y', strtotime($user->from_date));

public function convertDate($date,$format = 'd-m-Y'){
	return date($format, strtotime($date));
}
or
public function convertDate($date,$format = 'd/m/Y'){
        return \Carbon\Carbon::parse($date)->format($format);
}
$user->convertDate($user->from_date);
//$user->convertDate($user->from_date,'Y-m-d'); with format 

Comments

Submit
0 Comments