title: Getting only time from Carbon object
body: <p>Im reading an excel file a column with values like "1:45:00. But when <code>print_r($value["time"])</code> this value from my array I got a Carbon object like this:</p>
  
  <pre><code>Carbon\Carbon Object
  (
      [date] =&gt; 2018-10-30 01:45:00.000000
      [timezone_type] =&gt; 3
      [timezone] =&gt; America/US
  )
  </code></pre>
  
  <p>Then, when I insert to a bulk array my value with:</p>
  
  <pre><code>"time"=&gt;$value["time"]
  </code></pre>
  
  <p>In the database I got: <code>2018-10-30 01:45:00</code></p>
  
  <p>How can I insert only <code>01:45:00</code> and not the entire timestamp?</p>
  
  <p>EDIT: I thought that <code>$value["time"]-&gt;date-&gt;format("H:i:s")</code> would works but I got the error "Trying to get property 'date' of non-object"</p>
  
  <p>EDIT 2: This is how I read the data:</p>
  
  <p>The excel is like:</p>
  
  <pre><code>date         time
  ----------   -------
  30-10-2018   01:45:00
  </code></pre>
  
  <p>The code where I read the excel:</p>
  
  <pre><code>$data = Excel::selectSheetsByIndex(0)-&gt;load($path, function($reader) {
  })-&gt;get()-&gt;toArray();
  
  foreach ($data as $key =&gt; $value) {
      $time = Carbon::createFromFormat('Y-m-d h:i:s',$value["time"])-&gt;format('h:i:s');
      print_r($time);
      die();
  }
  </code></pre>
  
  <p>The output:</p>
  
  <p><code>Call to a member function format() on null</code></p>