Search code examples
phplaravelphp-carbon

Adding minutes using Carbon return wrong value


I am trying to add minutes to the current time, and here's what I get.

"2019-11-29T15:40:13.000000Z"

Here's my code for adding minutes:

    $date=  Carbon::now('Asia/Manila');
    $now = ($date->format("H:i:s"));

    $timeout = Carbon::parse($now)->addMinutes(60);
    return $timeout;

Assuming my current time is: 14:44:23

And adding 10 minutes to it will make it: 15:44:23


Solution

  • Try this

    $date = Carbon::now()->addMinutes(10);
    $now = $date->format("H:i:s");
    return $now;