Answers for "laravel carbon Could not parse '28/09/2021, 12:00:00 pm': DateTime::__construct(): Failed to parse time string (28/09/2021, 12:00:00 pm) at position 0 (2): Unexpected character"

PHP
0

laravel carbon Could not parse '28/09/2021, 12:00:00 pm': DateTime::__construct(): Failed to parse time string (28/09/2021, 12:00:00 pm) at position 0 (2): Unexpected character

Because Carbon does not understand d/m/Y format out of the box. If you use 
slashes it should be mm/dd/yyyy in that case. d/m/Y is not an official date 
format.

You can use :
{{ Carbon\Carbon::createFromFormat('d/m/Y', $holiday->holiday_date)->format('d-m-Y') }}
Posted by: Guest on September-28-2021

Code answers related to "laravel carbon Could not parse '28/09/2021, 12:00:00 pm': DateTime::__construct(): Failed to parse time string (28/09/2021, 12:00:00 pm) at position 0 (2): Unexpected character"

Browse Popular Code Answers by Language