0

I have a date returned from a javascript library in the format 23/10/2019 12:03:46 and while saving in the database i am trying to convert into a carbon object like below:-

 $order->delivery_date =  Carbon::createFromFormat('dd/mm/Y H:i:s',$request->time);

getting error

InvalidArgumentException: Unexpected data found.

also tried these similar links link1 link2 but not able to get out of this problem.

phpdroid
  • 1,642
  • 1
  • 18
  • 36

1 Answers1

2

the format string seems to be wrong. Try it like this:

$order->delivery_date = Carbon::createFromFormat('d/m/Y H:i:s',$request->time);

madalinivascu
  • 32,064
  • 4
  • 39
  • 55
mzolee
  • 88
  • 5