Issue
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.
Solution
the format string seems to be wrong. Try it like this:
$order->delivery_date = Carbon::createFromFormat('d/m/Y H:i:s',$request->time);
Answered By - mzolee
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.