Home > Forum > Forms > Subtraction two dates on a form

Subtraction two dates on a form
1

Hi,
I am a new guy here and I just started with webcon designer. I need help with mathematical operation on a form.
I want to subtract two dates to get number of days beetwen this two dates.
I know that I can use "datediff" function but my point is to get this 'dynamically'.
When user starts to fill form, he type date 1 and date 2 and below that he will see in third field numbers of days.
How to achive this on a form?

Hi Darek,

in the "on value change" of both date fields on tab "style and behaviour" of both fields add a rule that sets the value of the field you want to display the delta in. In my case the difference between reservation start and reservation end will be put into the field item to be reserved.

See screenshot below.

Good luck with webcon! :)

In reply to: Marek

It's so simple:) I tried in the same way but not on the dates but on the calculated field. Works great but there is one more thing. I also got error messege:"Incorrect operation. Value cannot be converted to date." Can you help?

Hi again, problem most likely is that always one field is empty, which will cause trouble with date functions. so you need to make sure you only calculate the datediff when both fields have values. Didn't think of that :) See screenshot below.