Link to home
Start Free TrialLog in
Avatar of drnadeem
drnadeem

asked on

Datetime diference?

I have two datetime strings in 2 edit boxes. How can I find the number of hours between these two values even if it exceeds 24 hrs.

eg: 7/21/2002 1:15:25 AM minus 7/22/2002 2:15:28 PM

thnks
ASKER CERTIFIED SOLUTION
Avatar of Cynna
Cynna

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lee_Nover
Lee_Nover

drdaem if you have Delphi6 then you can use the DateUtils unit and the HoursBetween function
there are also DaysBetween, SecondsBetween, ... check out the DateUtils unit :)
Try this:
Edit3.Text := DateTimeToStr((StrToDateTime(Edit1.Text) -              StrToDateTime(Edit2.Text))/24);
Chalo,

Did you tried out your proposed answer?

I see you are new to EE. Proposing an answer is generally not considered a good practice here. But if you propose it anyway, you should be sure it works, and it's a different one than other poster suggested. In this case, neither is true.
In the future, please consider posting a comment and let the asker choose the right answer for himself.
Avatar of kretzschmar
only a b-grade for a perfect work ?

:-(
:-) ...