Carbon format date to datetime code example
Example 1: carbon now format
use Carbon/Carbon
Carbon::now()->format('Y-m-d H:i:s');
Example 2: string to carbon
$date = Carbon\Carbon::parse($rawDate);
use Carbon/Carbon
Carbon::now()->format('Y-m-d H:i:s');
$date = Carbon\Carbon::parse($rawDate);