date format change in laravel blade 1

date format change in laravel blade

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

Here is what the above code is Doing:
1. We are using the date_format() function to format the date.
2. The date_format() function accepts two parameters:
a. The date to be formatted.
b. The format in which the date should be formatted.
3. The format parameter accepts the same characters as the date() function.
4. The date_format() function returns the formatted date.
5. We are using the date_format() function to format the date in the dd-mm-yyyy format.
6. We are using the date_format() function to format the date in the D M Y format.

Similar Posts