Adding time together...

Hello there,

I have a list of times like
3:00:00
5:45:00
9:04:00
1:00:00
15:00:00

and I want to add them all up
but what happens is when it gets to 23:59:00 it rests back to 0:00:00....
How can I keep it adding without resetting? so I can get results like 71:00:00 etc

Regards
Nick
LVL 10
wildzeroAsked:
Who is Participating?
 
mokuleCommented:
procedure TForm1.Button1Click(Sender: TObject);
var
  dt: TDateTime;
  h,m,s,ms: word;
begin
  dt := StrToTime('3:00:00');
  dt := dt+StrToTime('5:45:00');
  dt := dt+StrToTime('9:04:00');
  dt := dt+StrToTime('1:00:00');
  dt := dt+StrToTime('15:00:00');
  DecodeTime(dt,h,m,s,ms);
  Edit1.Text :=  Format('%d:%2.2d:%2.2d',[h+24*Trunc(dt),m,s]);
end;
0
 
wildzeroAuthor Commented:
Awesome - thank you very much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.