How to calculate dates difference?

  • Profile Image
    Anton
    Asked on March 21, 2018 at 07:19 AM

    Hi Evereyone 

    For the life of me i cant get this done to display amount of days between arival and departure dates


     what i need is a client to input arrival and departure dates and i want that to be multiplied by amount of people and then the amount per day ,giving him a total for his stay


    Thanks ,the closest i got was

     https://www.jotform.com/answers/571563-Can-I-calculate-the-days-between-two-dates#3

  • Profile Image
    Adrian
    Answered on March 21, 2018 at 10:17 AM

    You can achieve this using the Form Calculation Widget.
    Help Article: How to Perform Form Calculation Using a Widget

    I have created a DEMO form for you. https://form.jotform.com/80794213255962

    You can calculate the dates difference by subtracting the fields in the Form Calculation Widget.

    152164167211.png

    For the amount per day per person, you can use a number field, set a default value, and make it read-only. This field is not really needed but it is easier to change the calculation if this amount ever changes.

    152164173613.png

    You also need a field for the number of people. Then, you multiply all of them using the Form Calculation Widget again.

    152164180212.png

    This can, of course, be done without the extra calculation of the dates difference in another field and without the amount per day field.

    152164184115.png

    Feel free to clone my form and adjust it to your needs.