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

Calculating hours between to dates

edited June 2004 in End User
Hello

I have to date fields and want to find out how many hours it?s between those
to date values. And present it with in a textbox. All the fields are in the
detail band. Any help is appreciated

Regards
Stig Arvidsson

Comments

  • edited June 2004
    Hi Stig,

    I would suggest placing a TppVariable on your report, and in the OnCalc
    event of the variable, calculate the hours between the two dates using the
    HoursBetween Delphi method. Something like the following.

    uses
    DateUtils;

    procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
    var
    lStartDate: TDateTime;
    lEndDate: TDateTime;
    begin

    lStartDate := Report.DatePipeline['StartDate'];
    lEndDate := Report.DatePipeline['EndDate'];

    Value := HoursBetween(lStartDate, lEndDate);

    end;

    --
    Best Regards,

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