title: A trigger to calculate hour difference between two DateTime fields
body: <p>3 fields in a Table : START_DATE, END_DATE , DIFF. All three are DATETIME fields. I would like a trigger (AFTER UPDATE) to calculate the time difference between the START_DATE and END_DATE values in the DIFF field. I would like the result to be like : 01 Day -  12 Hours - 15 Min. How can I achieve this ? I would like to know also how it is done i.e the way to show the hour difference so that DIFF would display something like 27:15:00.</p>
  
  <p>This seems to work:</p>
  
  <pre><code>CREATE TRIGGER [DIFF]
  AFTER UPDATE OF [end_date]
  ON [Table1]
  BEGIN
  UPDATE Table1 SET DIFF = 
  cast(
           (
                    strftime('%s',Table1.end_date)-strftime('%s',Table1.start_date)
           ) AS INT
        ) / 60/60 ;
  END
  </code></pre>