-
AgilityAssoc.CanadaAsked on March 5, 2019 at 11:53 AM
Hello JF,
Ref: 83354135430955
I would like to verify if this logic works or not. The idea is to determine the length of time between two date fields. I used the calculator widget to subtract the end date from the start date.
Am I doing this correctly? When I tried it, It showed a value of 2100 difference for Mar 2 to Mar 23?
Robert
Update:1
Hi,
In order to get it working I had to divide the answer by 100, can you please explain???
Robert
Update:2
Now I used Update /Calculated Field and I still had to divide by 100 but now I had to add 1 so that Mar 1 to Mar 2 is 2 days.
This is confusing me after searching and finding this was how it is done... It is working but I don't know exactly why.
Robert
-
AgilityAssoc.CanadaReplied on March 5, 2019 at 12:07 PM
Still waiting for some help
-
AgilityAssoc.CanadaReplied on March 5, 2019 at 1:01 PM
Still waiting for some help. March 6 2019 07:00 AM
-
AgilityAssoc.CanadaReplied on March 6, 2019 at 4:50 PM
Still waiting for some help. March 6 2019 16:50
-
jherwinReplied on March 6, 2019 at 7:18 PM
Sorry for delayed response. Posting response only gets your thread in the new query. Please note that we are responding to threads from old to latest.
To clarify, do you want to show how many dates are on two date pickers? If yes, please check my demo form here: https://form.jotform.com/90647322220953.
Also, there is only one (1) day if you choose March 1 as the start date and March 2 as the end date so I think the calculation is correct. If you want to make it two then you just need to add +1 to your calculation.
-
AgilityAssoc.CanadaReplied on March 6, 2019 at 8:07 PM
OK... For our calculation there are two days for the event. If I pick Mar 9 and March 10 I want a value of 2 for a 2 day event.
When I try your demo I get 1] for an answer, why the square closing bracket? Also why am I dividing by 100?
-
jherwinReplied on March 6, 2019 at 9:17 PM
Sorry about that, I accidentally made the "floor" into string/text type. I fixed it now and it should work as expected. I also checked your form and calculation and it looks like you're able to fix the issue now.
Let us know if you need any further assistance.
-
jherwinReplied on March 6, 2019 at 9:22 PM
In addition, I changed your floor word into math function. It seems you only typed the floor word in the calculation.
Related Guide: Form Calculation - Math Function Reference
Please test the form and let us know how it goes.
-
AgilityAssoc.CanadaReplied on March 6, 2019 at 9:52 PM
OK... yes that is what I did so now it is a function but you didn't require the /100 as I do.
If I don't I get 101 days?
-
jherwinReplied on March 6, 2019 at 11:42 PM
This is due to the date format of Mini Date Picker. I used the normal date picker on my demo form which is why it works without /100.
You can switch to the normal date picker if you want to get the days. I have tried the mini date picker and other date picker widgets, it does not give the correct answer if you set the end date year to 2020 etc.
-
AgilityAssoc.CanadaReplied on March 7, 2019 at 9:13 AM
Hi,
Thank you for the explanation. Although it helps me understand somewhat, I guess I would have to actually see the date values differences to appreciate what is actually occurring. I just may try it out on a test form that I integrate to G-Sheet and see the results.I won't switch as it will mess-up existing data.
Thank You for the help.
Best,
Robert