D. Richard Hipp wrote:
Jake Skinner wrote:


Could anyone suggest other ways of achieving summing of times ie sum(end_time - start_time). At the moment I have a rather unwieldy sql query (see below).


sum(
    (strftime("%H",end_time)*60+strftime("%M",end_time))      -
    (strftime("%H",start_time)*60+strftime("%M",starttime)) )



sum(end_time - start_time)*1440

Actually, depending on what format you use to store your times, you might need to do this:

sum(julianday(end_time)-julianday(start_time))*1440

The julianday() function will convert from whatever time format
you are using into the julian day number format that I assumed
you were using in my original email.


end_time and start_time are both in (fractional) days since the julian epoch (-4713-11-24 12:00:00 UTC). The "*1440" at the end converts from days into minutes. If you want an integer number of minutes, do this:

round(sum(end_time-start_time)*1440)





-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to