You're looking for this script:
put timeDif(cd fld 1,cd fld 2) into cd fld 3
function timeDif theDate1,theDate2
convert theDate2 to seconds
convert theDate1 to seconds
put theDate2 - theDate1 into myDif
put myDif div (24*60*60) into myDays
put myDif mod (24*60*60) into myRemainder
put myRemainder div (60*60) into myHours
put myRemainder mod (60*60) into myRemainder
put myRemainder div 60 into myMinutes
put myRemainder mod 60 into mySeconds
return myDays && myHours && myMinutes && mySeconds
It works in LiveCode and HyperCard, possibly even with SuperCard, but I
don't have a Mac at my disposal right now to test that.
This script works, but I'm not sure how DST affects it.
Buy the most extensive book on the
Op 15-Feb-18 om 21:05 schreef KA4HJH ka4hjh@[redacted].com[HyperCard]:
> I'm writing a simple stack to keep track of battery life for my iDevices. I need a function that can calculate the elapsed time between two timestamps (date and time) with the difference in H:M:S or even just hours. I'm sure I could figure it out and reinvent the wheel in the process but I figured I'd ask first.
> I plan on converting my stack to LiveCode at some point. Info on how it's done in LC would be helpful as well. I looked at the forums and the dictionary but my eyes started to glaze over... Too much information.
> Terry Bowman, KA4HJH
> "The Mac Doctor"