title: Object of class DateTime could not be converted to string when comparing datetimes
body: <p>I have this string:</p>
  
  <pre><code>$actualTimePreformatted="16:46:00";
  </code></pre>
  
  <p>And I need mysql to select tu_id number <strong>294</strong>, as that ID has a range of times containing this time:</p>
  
  <p><img src="https://i.stack.imgur.com/G6MPE.png" alt="Table image"></p>
  
  <p>To do this I have passed the given time string to a time type data, and then selected the turn by comparing it's content: </p>
  
  <pre><code>$actualTime= DateTime::createFromFormat('H:i:s', $actualTimePreformatted);
  
  $timeMatchingTurns=mysql_query("SELECT * FROM turn_conf WHERE
          (tu_mon_1_s &gt;= $actualTime AND tu_mon_1_e &lt;= $actualTime) OR
          (tu_mon_2_s &gt;= $actualTime AND tu_mon_2_e &lt;= $actualTime) OR
          (tu_mon_3_s &gt;= $actualTime AND tu_mon_3_e &lt;= $actualTime)"); 
  
  $finalResult=mysql_fetch_array($timeMatchingTurns);
  
  $turn_id=$finalResult['tu_id'];
  </code></pre>
  
  <p>This, instead of storing on $turn_id the id <strong>294</strong>, gives me the error "Catchable fatal error: Object of class DateTime could not be converted to string".</p>