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

DateTime question

edited May 2002 in General
I have a DateTime variable and I assigned a date value to it.
How I can increment this value by 1 day (or number of days).
I Delphi I would just say MyVar:=MyVar+1. But this does not work in
RBuilder.

Comments

  • edited May 2002
    This does work the same way it does in Delphi. In the variable's OnCalc
    event increment it's Value property, i.e.

    ppVariable1.Value := ppVariable1.Value + X

    where X is the increment/decrement value. 1 corresponds to 1 day (5 is 5
    days and 1/(24*60) is 1 min, etc)

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited May 2002
    I'm using TDateTime variable declared in OnPrint procedure for a label, not
    ppVariable. And sometimes it works and sometimes it does not. It works if I
    use code like this:

    MyVar:=MyTable['Date_Field']+10;

    But this does not work:

    MyVar:=MyTable['Date_Field'];
    MyVar:=MyVar+10;


    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited May 2002
    TDateTime is just a Double type so there should be no difference between
    those two statements as long as the data field is being returned as the
    appropriate type.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.