Difference between two dates
Hi guys. Need a little help, and this may sound like a simple question. I
have a date that an issue was opened. I would like to display the total
time that the issue has been opened in a seperate variable. I understand
the theory behind this but do not know how to code it. Any help would be
great.
Many Thanks
Dave
--- posted by geoForum on http://delphi.newswhat.com
have a date that an issue was opened. I would like to display the total
time that the issue has been opened in a seperate variable. I understand
the theory behind this but do not know how to code it. Any help would be
great.
Many Thanks
Dave
--- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.
Comments
A TDateTime is essentially a Double representing the number of days since
12/30/1899. It is possible to subtract two TDateTime value from one another
to determine the number of days appart they are. If you are using Delphi,
try using the built-in DaysBetween routnine (see the Delphi help for more
information). If you are using RAP you can subtract the two. For instance
the following will give you the number of days between the two dates.
Value := orders['SaleDate'] - orders['ShipDate'];
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Just note that it would yield milliseconds no?
represented by a decimal so the value 12345 would represent a certain day at
12:00am and 12345.5 would be the same day at 12:00pm. If you are just
dealing with days, you can either drop the decimal or round it to the
nearest whole number.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com