Answers for "change the date format in laravel view page"

PHP
0

change the date format in laravel view page

// 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
Posted by: Guest on September-16-2021

Code answers related to "change the date format in laravel view page"

Browse Popular Code Answers by Language