Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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 CarbonCarbon::parse($date)->format($format);
}
$user->convertDate($user->from_date);
//$user->convertDate($user->from_date,'Y-m-d'); with format 

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #date #format #laravel #view #page
ADD COMMENT
Topic
Name
6+5 =