# How can I perform calculations based on a chosen date?

• stockton_pr
Asked on February 15, 2018 at 02:55 PM

conditional logic using dates i.e do a calculation based on a chosen date

• Jim_R
Answered on February 15, 2018 at 04:19 PM

I can't answer with certainty yet if what you're trying to do is achievable or not, unless you further explain how you plan to do the calculation with the date field.

Using CONDITIONS with the default DATE FIELD is doable on its own. With calculations though, it will highly vary depending on what you're trying to calculate and how you're planning to calculate it.

For starters, have a look at the guide linked below. It discusses various ways of getting differences between 2 dates (or time) just in case that's what you have in mind.

Complete guide: Mastering-Date-and-Time-Calculation

Otherwise, kindly get back to us with more info and a better description of what you're trying to achieve so we can better assist you.

• stockton_pr
Answered on February 15, 2018 at 04:43 PM
Ok so in simple terms a date range say for example from 1 Jan to 15 Feb
gives a price band of X, the next band from 16 Feb to April 1 gives y. So I
have to calculate based on the date times the number of adults say X times
...
• stockton_pr
Answered on February 15, 2018 at 04:43 PM
https://bookingenquiry.formstack.com/forms/camping_enquiry_form_1 this
where i am at so far but i am forced to have the fields visual with the
costs which is not cool
...
• Kevin_G
Answered on February 15, 2018 at 07:19 PM

I'm not sure if I understood completely your request. With JotForm you can perform calculations based on dates, we have indeed a widget that calculates the date difference between two dates, the difference value can be used on calculations so you can perform any calculations with it.

Here's an example: https://form.jotform.com/80457556850969

Here's the widget: https://widgets.jotform.com/widget/dates_difference

And here is a guide to perform calculations on your form: https://www.jotform.com/help/259-How-to-Perform-Form-Calculation-Using-a-Widget

where i am at so far but i am forced to have the fields visual with the costs which is not cool

With the shared fields, and as far as I know, the user needs to select both dates so the date fields will need to be shown. Now, please note that all the fields can be hidden so you may show the date fields only and hide the fields performing the calculations so your users do not see the values.

To hide a field simply, go to the builder and click on the desired element, click on the settings icon, go to the advanced tab and turn on the hide field option:

I hope this helps.