Title: Date Equation
Last modified: March 19, 2024

---

# Date Equation

 *  Resolved [fibbu](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/date-equation/)
 * 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 2 years, 2 months ago by [fibbu](https://wordpress.org/support/users/fibbu/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/date-equation/#post-17511448)
 * Hello [@fibbu](https://wordpress.org/support/users/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:
 *     ```wp-block-code
       (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](https://wordpress.org/support/users/fibbu/)
 * (@fibbu)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/date-equation/#post-17511752)
 * 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.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [fibbu](https://wordpress.org/support/users/fibbu/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/date-equation/#post-17511752)
 * Status: resolved