Hi Brad,
Try this solution:
 
function SubtractTime(A, B : TTime): TTime;
var
  H1, H2, M1, M2, HDiff, MDiff : integer;
begin
  H1 := HourOf(A);
  H2 := HourOf(B);
  M1 := MinuteOf(A);
  M2 := MinuteOf(B);
  if CompareTime(A, B) > 0 then
  begin
    H1 := HourOf(A);
    H2 := HourOf(B);
    M1 := MinuteOf(A);
    M2 := MinuteOf(B);
  end
  else
  begin if CompareTime(A, B) < 0 then
    H1 := HourOf(B);
    H2 := HourOf(A);
    M1 := MinuteOf(B);
    M2 := MinuteOf(A);
  end;
  if M1 < M2 then
  begin
    H1 := H1 - 1;
    M1 := M1 + 60;
  end;
  HDiff := H1-H2;
  MDiff := M1-M2;
  Result := StrToTime(IntToStr(Abs(HDiff))+':'+IntToStr(Abs(MDiff)));
end;


Brad Hall <[EMAIL PROTECTED]> wrote:
Maybe (Time3 - Time4) instead of the way U have it now... (Time4 -
Time3)



________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of soonhuat ong
Sent: Wednesday, 29 June 2005 3:52 PM
To: [email protected]
Subject: [delphi-en] differences between 2 time value




How do i calculate the differences between 2 time ?
Let's say:
Time1 = 13:00
Time2 = 12:00

The difference is 1:00 hour

I try (Time1 - Time2), and it works fine.. 
But when the total difference less than 1 hour, it give me difference
result:
For eg:
Time3 = 14:30
TIme4 = 14:00

(Time4 - Time3) will give me 12:30 .. what i want is 00:30. ANy idea ??


            
---------------------------------
Discover Yahoo!
Have fun online with music videos, cool games, IM & more. Check it out!

[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 




________________________________

YAHOO! GROUPS LINKS 



*      Visit your group "delphi-en
<http://groups.yahoo.com/group/delphi-en> " on the web.
        
*      To unsubscribe from this group, send an email to:
      [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
        
*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 



________________________________



[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 



---------------------------------
YAHOO! GROUPS LINKS 


    Visit your group "delphi-en" on the web.
  
    To unsubscribe from this group, send an email to:
 [EMAIL PROTECTED]
  
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


---------------------------------



                
---------------------------------
 Free antispam, antivirus and 1GB to save all your messages
 Only in Yahoo! Mail: http://in.mail.yahoo.com

[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to