Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > Samples

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2009, 10:08 AM
Mujaidin Mujaidin is offline
Junior Member
 
Join Date: Jun 2009
Posts: 4
Default How to subtract two time

How to subtract two time

exemple : 9:10 - 18:05 = 9:15 (9 hours and 15 minutes)

Help me please, sorry i dont speach Englis very well...

Last edited by Mujaidin; 07-03-2009 at 11:22 AM.
Reply With Quote
  #2  
Old 07-03-2009, 02:58 PM
Samuel Samuel is offline
Senior Member
 
Join Date: Feb 2006
Posts: 247
Default

Code:
Var
d1, d2 : TDatetime;
Begin
  d1 := StrToTime('09:10');
  d2 := StrToTime('18:05');
  ShowMessage(TimeToStr(d1-d2));
End;
Reply With Quote
  #3  
Old 07-06-2009, 11:19 AM
Mujaidin Mujaidin is offline
Junior Member
 
Join Date: Jun 2009
Posts: 4
Wink tanks 1.000 x info

Quote:
Originally Posted by Samuel View Post
Code:
Var
d1, d2 : TDatetime;
Begin
  d1 := StrToTime('09:10');
  d2 := StrToTime('18:05');
  ShowMessage(TimeToStr(d1-d2));
End;

tanks 1.000 x info
Reply With Quote
  #4  
Old 12-20-2010, 10:43 AM
Ivan Ivan is offline
Junior Member
 
Join Date: Oct 2010
Posts: 2
Default

Hey its a very informative forum to solving our math solution with in just few second.
Reply With Quote
  #5  
Old 04-17-2011, 07:55 AM
Lightkillar3 Lightkillar3 is offline
Junior Member
 
Join Date: Apr 2011
Location: Lewiston
Posts: 1
Default

good post,interesting
Reply With Quote
  #6  
Old 08-16-2012, 06:28 PM
emailx45 emailx45 is offline
Junior Member
 
Join Date: May 2012
Posts: 18
Thumbs up

Dear friends,

The TDateTime = 1 part Integer (days) and 1 part Float Point (Hours)

So, you can to do CALCULATIONS with a var TDateTime directly.

Use HELP from Delphi for more informations, for FUNCTIONS as:

Format(), DateTimeToSTR(), etc....
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.