[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 133
  • Last Modified:

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
0
wildzero
Asked:
wildzero
1 Solution
 
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now