3 Replies Latest reply on Aug 18, 2012 6:59 PM by RossHurley

    Using Year Function in a Calculation

    RossHurley

      Hi all,

       

      I’m not getting the expected result when using the Year function in a calculation. Simplified, the calc is:

       

      Year (Get ( CurrentDate )) - Year (AnotherDateField)

       

      If AnotherDatefield is, eg, 1/1/2010, I want to get an answer ‘2’, ie 2012 - 2010 = 2. But this calculation always returns ‘2011’.

       

      It returns ‘2011’ whatever the date in AnotherDateField is, so I can work out that the ‘Year (AnotherDateField)’ part of the calc is resolving as True, therefore 1, so 2012 - 1 = 2011. But that isn’t really the issue. I want to calculate the difference in number of years between two dates, eg, 2012 - 2010 = 2. Wrapping the calc in GetAsNumber doesn’t change the result, nor does wrapping the two parts of the calc individually in GetAsNumber. It seems it should be a simple calculation but I can’t figure it out. Any help would be appreciated.

       

      Ross Hurley

      Adelaide, Australia