Ad

Issue With Converting A Date Using Carbon

- 1 answer

$value="Mar 10 2016 09:12:03:000AM";
return Carbon::createFromFormat('Y-m-d H:i:s.u0', $value);

Please will someone please tell me how to use Carbon to convert this date to that format.

I'm getting: InvalidArgumentException in Carbon.php line 425: Unexpected data found. Unexpected data found. The separation symbol could not be found Unexpected data found. The format separator does not match Trailing data

Ad

Answer

use carbon like

$value="Mar 10 2016 09:12:03:000AM";
return \Carbon\Carbon::parse($value)->format('Y-m-d H:i:s.u0');
Ad
source: stackoverflow.com
Ad