• Resolved fibbu

    (@fibbu)


    Hello;
    I’m trying to set up an equation but I couldn’t succeed.

    I want to do this..

    There will be 2 dates in the background:
    It will cover the period between 11 March + ()YEAR and 09 April + ()YEAR..

    When the user says calculate.. It will get today’s date in the background..

    In other words, March 19 will calculate the number of days between the two dates above. In other words, it will calculate that it is the 9th day.

    If this date is not between 11 March + ()YEAR and 09 April + ()YEAR, today’s date will be displayed as an error message.

    I wonder how we will set up the equation?

    Thanks.

    • This topic was modified 8 months, 1 week ago by fibbu.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @fibbu

    In short you want to calculate the difference between 11/03/current year and today if the today is between 11/03 and 09/04. In this case, the equation can be implemented as follows:

    
    (function(){
      let d1 = DATEOBJ('11/03/'+YEAR(), 'dd/mm/yyyy'),
          d2 = DATEOBJ('09/04/'+YEAR(), 'dd/mm/yyyy');
    
      if( AND(d1 <= TODAY(), TODAY() <= d2) ){
        return DATEDIFF(d1, TODAY(), 'dd/mm/yyyy', 'd')['days'];
      } else {
        return 'Error message';
      }
    })()

    Best regards.

    Thread Starter fibbu

    (@fibbu)

    THANK YOU VERY MUCH FOR YOUR SUPPORT.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Date Equation’ is closed to new replies.