Subtracting TImestamps

I am trying to calculate the duration between two SQL timestamps in seconds, including the date. Any shortcuts or help would be appreciated. Any built in functions in XoJo that might help ?

Thanks,

Matt

format is: yyyy-mm-dd hh:mm:ss

You could use ParseDate to turn them both into Date objects and then get TotalSeconds from each of them and subtract.

dim d1, d2 as Date Dim Delta as double If parsedate(d1, datestr1) and ParseDate(d2, datestr2) then Delta = abs(d1.totalseconds - d2.totalseconds) End If

That’s exactly what I want. Am I correct in understanding that parsedate does’t deal with the time portion of a datestamp?

It should parse the whole string just fine.