Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Difference between two dates

edited September 2006 in General
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

Comments

  • edited September 2006
    Hi Dave,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    Hi!
    Just note that it would yield milliseconds no?

  • edited September 2006
    It is my understanding that when dealing with TDateTime types, the time is
    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.