laravel carbon parse format code example
Example 1: php change date format
To convert the date-time format PHP provides strtotime() and date() function. We change the date format from one format to another.
Change YYYY-MM-DD to DD-MM-YYYY
<? php.
$currDate = "2020-04-18";
$changeDate = date("d-m-Y", strtotime($currDate));
echo "Changed date format is: ". $changeDate. " (MM-DD-YYYY)";
?>
Example 2: laravel carbon today date format
$today = Carbon::now()->format('Y-m-d');
Example 3: carbon now format
use Carbon/Carbon
Carbon::now()->format('Y-m-d H:i:s');
Example 4: carbon now
Carbon::now();