4 Replies Latest reply on Feb 1, 2012 3:23 PM by philmodjunk

    Calculate months from date



      Calculate months from date


      Could You please help me with this one:


      In my database I have a field - „date of operation” for each record. And would l like to have a calculation in a new field - months from operation - so it will calculate how many months have passed till today 


      Thank You for help

        • 1. Re: Calculate months from date

          You'll need to define "month" here.

          You could treat every 30 days as a "month" in your calculation (elapsed days divided by 30)

          Or you can count elapsed calendar months, but then you need to tell us what do do with any fraction of a moth. Round up? Discard it? Report it as days?

          • 2. Re: Calculate months from date

            You can easily calculate the number of days between a date and the other, but you can not calculate the months if you do not declare what it is for you a month.
            1) A set of 30 days
            2) A variable pattern of days, which takes into account every single month of the year.

            Edit: Hi Phil, I was too late :)

            • 3. Re: Calculate months from date

              Ok Thank You, So could please provide some more info on how can I do it  with defining month as a 30 days interval



              • 4. Re: Calculate months from date

                ( Get ( CurrentDate ) - Date of Operation ) / 30

                Date fields are really special number fields that store the number of days from 12/31/0000 to the date shown in that field. Thus, they can be used in many calculations just as though they are number fields.

                Also, this calculation will not update correctly in a field definition unless the field is a calculation field with "unstored" specified in Storage options.