Title: problem with setting dates
Last modified: February 13, 2024

---

# problem with setting dates

 *  Resolved [monika999](https://wordpress.org/support/users/monika999/)
 * (@monika999)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/)
 * Hello, amazing plugin. Thanks. I have a problem. I want the booking price to 
   be different after selecting a given day of the week. e.g. Monday – 60 euros 
   Tuesday – 70 euros Wednesday – 50 euros Thursday – 50 euros Friday 60 euros Saturday
   40 euros Sunday – 80 euros Please help

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/#post-17421376)
 * Hello [@monika999](https://wordpress.org/support/users/monika999/),
 * In this case, you must walk the days from checking to checkout and summing the
   corresponding amounts.
 * For example, assuming you have two date fields for the checking and checkout.
   I’ll call the fieldname1 and fieldname2, and you want to sum their corresponding
   prices, including the first and last days.
 * You can insert a calculate field in the form and enter the equation:
 *     ```wp-block-code
       (function(){
       var prices_list = {
       1:80,
       2:60,
       3:70,
       4:50,
       5:50,
       6:60,
       7:40
       },
       d1 = DATEOBJ(MIN(fieldname1,fieldname2)), 
       d2 = DATEOBJ(MAX(fieldname1,fieldname2)), 
       result = 0;
   
       while(d1<=d2){
       result += prices_list(WEEKDAY(d1));
       d1.setDate(d1.getDate()+1);
       }
   
       return PREC(result,2);
       })()
       ```
   
 * And that’s all.
 * Best regards.
 *  Thread Starter [monika999](https://wordpress.org/support/users/monika999/)
 * (@monika999)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/#post-17421558)
 * Hi. Thanks for the quick reply. That’s not exactly what I had in mind. The idea
   is that after selecting a given day from the calendar (su, Mo..), the final result
   will display the number (price) assigned to it.
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/#post-17421645)
 * Hello @@monika999
 * In this case, the process is simpler. Assuming the date field is the fieldname1,
   the equation in the calculated field would be:
 *     ```wp-block-code
       ({1:80,2:60,3:70,4:50,5:50,6:60,7:40})[WEEKDAY(fieldname1)]
       ```
   
 * Best regards.
 *  Thread Starter [monika999](https://wordpress.org/support/users/monika999/)
 * (@monika999)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/#post-17421711)
 * You are amazing. Thanks. What if we took into account that until 4 p.m. the price
   = 60, and after 4 p.m. the price = 80 every day??? Thank you for your help:)
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/#post-17421733)
 * Hello [@monika999](https://wordpress.org/support/users/monika999/)
 * In that case, you must use operations like HOURS and include conditional statements
   as part of the equation. Learn more about the Date/Time operations module by 
   reading the following section in the plugin documentation:
 * [https://cff.dwbooster.com/documentation#datetime-module](https://cff.dwbooster.com/documentation#datetime-module)
 * If you require assistance implementing your equations, please [contact us](https://cff.dwbooster.com/customization)
   through the plugin website.
 * Best regards.

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

The topic ‘problem with setting 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/)

 * 5 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/problem-with-setting-dates/#post-17421733)
 * Status: resolved