Re: Re: How can I add one time to the other?


Posted by Kev Gleeson on March 13, 2001 at 21:06:27:

In Reply to: Re: How can I add one time to the other? posted by Webmaster Guido on June 03, 2000 at 16:54:26:

Time 1 = 1:45 mins. Time 2 = 1:55 mins
Total = 3:40 mins

Take the first time and convert it to a decimal time; 1 hour 45 mins = 1.75 using the DeciTime function below.

Use the following to add the two times.

Hrs := DeciTime(Hr1)+DeciTime(Hr2);=3.6667
Then
Int(3.6667)+(Frac(3.6667)*0.6)= 3.40002
(3:40 mins)

You can format the output using ffFixed

function DeciTime(Hrs :Double):Double;
begin
DeciTime := Int(Hrs) + (Frac(Hrs)/0.6);
end;

Regards

Kev G