Date calculations

BennyGiebensBennyGiebens Member Posts: 43
edited 2000-01-14 in Navision Financials
Is there a simple way in navision fincancials to calculate the number of months between two dates ???

Rgds
Benny Giebens
Rgds
Benny Giebens

Comments

  • TheDoubleHTheDoubleH Member Posts: 67
    Hi Benny --

    Well I'm not quite sure, what you are meaning.

    But you could try this:

    NoOfDays := ToDate - FromDate;

    based on that you could devide with 30..

    But you could also use the DATE2DMY.

    FromMonth := DATE2DMY(FraDato,2);
    ToMonth := DATE2DMY(TilDato,2);

    NoOfMonths := ToMonth - FromMonth;

    Kind Regards

    Henrik Helgesen,
    Navision Solution Developer
    Kind Regards

    Henrik Helgesen,
    President | Helgesen Consulting
    about.me | LinkedIN
  • BennyGiebensBennyGiebens Member Posts: 43
    of course, stupid me.
    To get a difference if the dates are in different years i'm going to use this


    verschil := ((DATE2DMY(datum2,3) - DATE2DMY(datum1,3)) * 12) + (DATE2DMY(datum2,2) - DATE2DMY(datum1,2));

    Thnx a lot
    Rgds
    Benny Giebens
    Rgds
    Benny Giebens
  • Lars_WestmanLars_Westman Member Posts: 116
    Another handy way to calulate months, weeks and so on is using the virtual date table. SETRANGE on the date type You are interested in and the starting and ending date. Then count the number of records

    //Lars Westman
  • BennyGiebensBennyGiebens Member Posts: 43
    The virtual date thing can be handy also !!!!!
    You can do alot with those virtual tables, a shame they arn't beter documented !!!


    Thnx
    Benny Giebens
    Rgds
    Benny Giebens
Sign In or Register to comment.