In my laravel project, I want to increase the date time with the previous date time.
Here is my code
The results of these two lines are
2018-01-28 21:23:56 2018-06-28 21:43:29
What I want to do is sum the both dates.
How can I achieve this? Any idea or thought? Thanks.
<strong>Edit with more clear view</strong>
I want to find the remaining days of the expire date from
now and then want to add this remaining date with the new date. Hope it clears.
If you want to add six months to order expiration date, just do this:
$new = $order->expire_date->addMonths(6);
This will work since
$order->expire_date is a Carbon instance.
If it's not, just parse it first:
$new = Carbon::parse($order->expire_date)->addMonths(6);
you can add something like that: