Title: Fixed value between two dates
Last modified: August 21, 2016

---

# Fixed value between two dates

 *  Resolved [damiend1](https://wordpress.org/support/users/damiend1/)
 * (@damiend1)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fixed-value-between-two-dates/)
 * Hello,
 * I have a table with fixed values​​:
 * 1 day = 15 €
    2 days = 27 € more than 2 days = € 5 per additional day
 * Is it possible to calculate this with the module date?
 * Thank you in advance
    Damien
 * [http://wordpress.org/plugins/calculated-fields-form/](http://wordpress.org/plugins/calculated-fields-form/)

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fixed-value-between-two-dates/#post-4240112)
 * Hi,
 * Suppose your form includes two date fields, start date (called fieldname1) and
   end date (called fieldname2), the corresponding equation in this case would be:
 * (function(){
    var r = abs(fieldname2-fieldname1); if( r == 1) return 15; if( 
   r == 2) return 27; if( r > 2 ) return 5*r; })();
 * Note: Transform the previous equation with the fields names used in your form.
 *  Thread Starter [damiend1](https://wordpress.org/support/users/damiend1/)
 * (@damiend1)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fixed-value-between-two-dates/#post-4240144)
 * Hi,
 * Tanks it works !
 * After this i just need to add a somme for an option, How its possible to calculate,
   the result of the function above and other variable.
 * Tanks
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fixed-value-between-two-dates/#post-4240151)
 * Hi,
 * Suppose that your equation includes another field (called fieldname3) that should
   be added to the value related with the date fields, in this case the equation
   should be modified like follow:
 * (function(){
    var r = abs(fieldname2-fieldname1); var n; if( r == 1) n = 15; 
   if( r == 2) n = 27; if( r > 2 ) n = 5*r;
 * return n+fieldname3;
    })();
 * Note: the previous equation is only a demo, but contains the pattern to create
   your own equation.
 *  Thread Starter [damiend1](https://wordpress.org/support/users/damiend1/)
 * (@damiend1)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/fixed-value-between-two-dates/#post-4240184)
 * Wouaw tanks ! amazing plugin, just need to go to pro version !

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

The topic ‘Fixed value between two dates’ 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/)

 * 4 replies
 * 2 participants
 * Last reply from: [damiend1](https://wordpress.org/support/users/damiend1/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/fixed-value-between-two-dates/#post-4240184)
 * Status: resolved