carbon mysql d m y to y-m-d 1

carbon mysql d m y to y-m-d

$object->date = \Carbon::createFromFormat('d-m-y', $regdate)->format('Y-m-d');

Here is what the above code is Doing:
1. We’re creating a new Carbon object from the date string we have.
2. We’re then formatting the Carbon object to the format we want.
3. We’re then assigning the formatted date to the $object->date property.

Similar Posts