Answers for "carbon\exceptions\invalidformatexception: could not parse 'may 21 2000 12:00:00:am': datetime::__construct(): failed to parse time string (may 21 2000 12:00:00:am)"

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 :
{{ CarbonCarbon::createFromFormat('d/m/Y', $holiday->holiday_date)->format('d-m-Y') }}
Posted by: Guest on September-28-2021

Code answers related to "carbon\exceptions\invalidformatexception: could not parse 'may 21 2000 12:00:00:am': datetime::__construct(): failed to parse time string (may 21 2000 12:00:00:am)"

Browse Popular Code Answers by Language