title: How can I store calculated time into database using mysqli data type time?
body: <p>I am trying to store calculated time into database using mysqli data type time. Calculated means I am trying to store play time or the time user spent to play game. So I have column <code>spent_time</code> which data type is <code>time</code> and I set default value <code>00:00:00</code>. </p>
  
  <p>When I try to store 5 minutes and 30 seconds <code>00:05:30</code> the query returns following error </p>
  
  <pre><code>SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect time value: '' for column 'time_spent' at row 1
  </code></pre>
  
  <p>and following is the script which is inserting record using query</p>
  
  <pre><code> $Log   = new Log;
   $Log-&gt;user_id       = request()-&gt;user()-&gt;id;
   $Log-&gt;time_spent    = $time;
   $Log-&gt;save();
  </code></pre>
  
  <p>Can someone kindly guide me how can I fix this error, I would appreciate. Thanks</p>