title: Time difference in minutes between two times
body: <p>Been struggling to get the difference in minutes between 2 times. One time comes from a field of data type TIME in SQL Server. The other value is a string added to the SQL query. I'm running in SSRS 2008 R2 It looks like this:</p>
  
  <pre><code>DATEDIFF(mi, CONVERT(TIME, '23:59:59'), _Travel.Start_Time) AS TIME_DIFFERENCE
  </code></pre>
  
  <p>I get the error: Conversion failed when converting date and/or time from character string</p>
  
  <p>I've tried casting '23:59:59' to a TIME type 'AS TIME' but get similar error. I have tried declaring a variable but SSRS won't allow it. Everything I try give similar error. The time 23:59:59 will always be the same, but _Travel.Start_Time will be whatever is in that field in DB. The output for _Travel.Start_Time is in the format 00:00:00</p>
  
  <p>Any ideas how I can get difference in minutes between 23:59:59 and db value?
  Ta</p>
  
  <p>added: </p>
  
  <p>CAN'T BELIEVE IT. _Travel.Start_Time IS VARCHAR not TIME. Have now tried    </p>
  
  <pre><code>DATEDIFF(CONVERT(TIME, '23:59:59'), CONVERT(TIME, _Travel.Start_Time)) 
  </code></pre>
  
  <p>but still getting same error. However, have noticed that there are nulls/empty fields in _Travel.Start_Time field</p>