How to calculate dates difference?

  • Anton
    Asked on March 21, 2018 at 7: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

  • Adrian
    Replied 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.

    How to calculate dates difference? Image 10

    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.

    How to calculate dates difference? Image 21

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

    How to calculate dates difference? Image 32

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

    How to calculate dates difference? Image 43

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