Solved

Get the number of days between 2 TDateTime structures

Posted on 1999-01-27
7
162 Views
Last Modified: 2010-04-06
Has anybody some code handy to get the number of days that had passed between two TDateTime structures?
0
Comment
Question by:jonnyfive
  • 3
  • 3
7 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
ID: 1363542
Very simple. Just look at the difference.

dt2-dt1 = 2.5    =>  two and a half days past by...

Regards, Madshi.
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1363543
Sure, just subtract 1 from the other.  Like This

function ElapsedDays(D1, D2: TDateTime): integer;
begin
  Result := Round(abs(D1 - D2));
end;
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1363544
Oops, Sorry Madshi - Posted at same time :)

Heath
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 5

Expert Comment

by:heathprovost
ID: 1363545
BTW - I should have put Trunc instead of Round. Wasnt thinking

Heath
0
 

Author Comment

by:jonnyfive
ID: 1363546
Besides that I'm wondering if you guys ever sleep, I'm very impressed with the quick and excellent solutions I got from you. Thanks a lot and points well earned :-))

0
 
LVL 20

Expert Comment

by:Madshi
ID: 1363547
:-)

Am sitting at work right now. So I check my eMails and EE every hour. It's good that my boss works two streets from here...  :-)

Regards, Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1363548
Hi Heath, hmmm. If I would have written a little function (like you did), you would have probably been faster than I. So I'm sorry for taking the points away...    :-)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 69
Magic Software info 18 131
delphi parse string to params 3 123
Moving (cutting/pasting) controls in a TTabbedNotebook... 7 34
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question