Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

difference between date n times

Status
Not open for further replies.

minckle

Programmer
Mar 17, 2004
142
GB
I have to date/times
e.g 19/11/2004 12:34:43 and 19/11/2004 12:38:12

i want to to write a function that tells me if the 1st DateTime is greater or less than 5 minutes before the 2nd DateTime

Its the 5 min bit that im struggling on

Date1 < Date2 - tells me if 1 is less than 2 but how do i do the 5 min bit
 
Look under the delphi help for DecodeDateTime. Using this command you will be able to get a solution.

[blue]"Mr Flibble says: Game Over, boys!" [/blue]
 
Hi,

don't know what delphi version you have but in delphi 7 you have the MinutesBetween function...

--------------------------------------
What You See Is What You Get
 
Ive had a look for that function in Delphi 5 but cant find it. Ill have a go with the DecodeDateTime Function
 
Or, if you want to use a constant that is the numeric value of 5 minutes, you can do something like this:
Code:
const
  C_5_MIN = 0.00347223;
I have this set up in a utility file and use it frequently when I'm calculating time delays.

-Dell

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top