How to format time to "H:i:s" in laravel using carbon : <p>I would like to find total time spent on a project given that the user enters the "start time" and "stop time". I have been able to access the time spent but it comes as an array of Date Interval. </p>

<p>I want to just format the results to "H:i:s" (Hour:Minute:Seconds)</p>

<p>Here's the code from my controller</p>

<p>I have already declare the use of Carbon Class(use Carbon/Carbon;) at the top of the controller</p>

<pre><code>    $start = Carbon::parse($request-&gt;strt_time);
    $end = Carbon::parse($request-&gt;stp_time);
    $time_spent = $end-&gt;diff($start);

    $spent_time = $time_spent-&gt;format('H:i:s');
</code></pre>

<p>I expect the output to be 00:00:00 but I am getting a string "H:i:s"</p>
