Calc difference between two dates

I am trying to calculate the difference between two dates in my report. Maybe I am just over looking something, but I can't find any functions in FastReports to do that.

Is there any way to get this done?

Comments

  • edited 5:18AM
    What kind of result are you expecting, after all? How many days are between two dates?

    You can just subtract the dates, and you will get it. ;)

    Regards.
  • edited 5:18AM
    ;) Thanks, I don't know why I assumed you had to use a function. Note to self: Next time get some sleep before posting...
  • edited 5:18AM
    Can I transfer the number of days to months
  • gpigpi
    edited 5:18AM
    Yes, you can
    Use NumberOfDays/DaysInMonth
  • edited May 2013
    hello halim,
    I'll give you an example,
    procedure finOnChange(Sender: TfrxComponent);
     var a,m,m1,j:word;
    begin
    DecodeDate(debut.date,a,m,j);
    DecodeDate(fin.date,a,m1,j);
    NB_MOIS.TEXT:=inttostr(int(m1)-int(m)+1);
    end;
    
    where debut and fin are TfrxDateEditControl and Nb_mois is TfrxMaskEditControl
    good luck
    Two will not learn(teach); the shy person and the arrogant person

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.