-
aaronchanAnswered on December 28, 2020 10:50 PM
is it possible to calculate the number of years by using a 'Date Picker' field vs a 'Date Picker Month Year' field ? Please advise
-
Lorenz JotForm SupportAnswered on December 28, 2020 11:12 PM
Thank you for contacting us.
I believe the formula to calculate the difference in years between 2 date fields was explained in this guide https://www.jotform.com/help/443-mastering-date-and-time-calculation.
Please give it a try and let us know how it goes.
-
aaronchanAnswered on December 28, 2020 11:26 PM
Thanks Lorenz_A for the reply, unfortunately, what I am asking is about to calculate the difference in years between a 'Date Picker' field vs a 'Date Picker Month Year' field, which the calculation doesn't allow me to do so.
-
Patrick_RAnswered on December 29, 2020 12:19 AM
Hello Aaronchan! If you're trying to calculate difference between two Date fields; then you can do this. The returned value would be in days. Here is an example form: https://form.jotform.com/203630934704957
- what I am asking is about to calculate the difference in years between a 'Date Picker' field vs a 'Date Picker Month Year' field
I am not very sure about what you mean by 'Date Picker Month Year' field. Can you please share your Form URL?
We'll take a look and get back to you.
Thank you!
-
aaronchanAnswered on December 29, 2020 02:18 AM
Hi Patrick_R, here it is the form for your checking.
https://form.jotform.com/203631189258055
What am I trying to do is to calculate the Age, 'Course Date' of DD/MM/YYYY - "Date of Birth' of MM/YYYY.
Please advise.
-
Ashwin JotForm SupportAnswered on December 29, 2020 03:39 AM
With a little workaround, it is possible to achieve your requirement. Please take a look at the following cloned form where I have added few fields to calculate Age based on the widgets you have already added in form: https://form.jotform.com/203631391718960
Feel free to clone this form for a closer look. The following guide should help you in form cloning: https://www.jotform.com/help/42-how-to-clone-an-existing-form-from-a-url
Hope this helps.
Do get back to us if you have any questions.
-
aaronchanAnswered on December 29, 2020 09:48 PM
Hi ashwin_d, just tried your clone form, unfortunately the Age calculated is always zero, can you help to take a look again ? Many thanks.
-
aaronchanAnswered on December 29, 2020 09:58 PM
Oh..., I got it, the Age field is set to be read only, that's why it doesn't show up, it works now, many thanks!!
-
Vick Support Team LeadAnswered on December 29, 2020 10:02 PM
I've just fixed the calculation for the Age field. Please try again and let us know if you need further assistance.
Thanks
-
aaronchanAnswered on December 29, 2020 10:18 PM
Good, it was fixed. However, the result seems to be a bit strange. Say the course date is Dec 1, 2025 and the Date of Birth is Dec 2015, age supposed to be 10, but it shows 10.89.
-
Yau_CAnswered on December 29, 2020 11:14 PM
Hi Aaronchan,
Please allow me more time to work on this and I will get back to you.
Best,
-
Yau_CAnswered on December 29, 2020 11:38 PM
Hi Aaronchan,
I have created a form for you: https://form.jotform.com/203638194221957
You may clone my form and test it: https://www.jotform.com/help/42-how-to-clone-an-existing-form-from-a-url
Best regards,
-
aaronchanAnswered on December 30, 2020 08:01 PM
Hi Yau_C, thanks for the update, this calculated accurate. However, the course date supposed to be a pre-defined date by me, but the date of birth has to be input by the participant and it has to be month and year only not a full date. Is there anyway, I can manage to handle this requirement ? Please advise.
-
Vick Support Team LeadAnswered on December 30, 2020 09:15 PM
Hi there,
My colleague used the Date Difference widget in the demo form. Unfortunately, it does not have the option to enter pre-defined data. Form user will have to select the date in this case.
Thanks
-
aaronchanAnswered on December 30, 2020 09:39 PM
Dear support,
Let me recap my requirement once again, due to the confidentiality requirement, it only allows me to collect participant's date of birth with just month and year, not the full date. As of this, is there any way that I can calculate his/her age by comparing the course date (full date with day/month and year), which is pre-defined by me ? Pls advise.
-
Vick Support Team LeadAnswered on December 30, 2020 11:09 PM
Hi there,
I've made some changes to Ashwin's demo form again. Please check it on the link below now.
https://www.jotform.com/203631391718960
Previously the decimals were showing in results. I've fixed the calculation again so that it will now show a round figure as per your requirement. Also, the Age field will only appear after the date of birth is entered.
Here is how you can clone it.
https://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL
Let us know if you need further assistance.
Thanks
-
aaronchanAnswered on December 30, 2020 11:29 PM
-
Vick Support Team LeadAnswered on December 31, 2020 12:57 AM
I'm checking this for you and will get back to you shorlty.
Thanks
-
Vick Support Team LeadAnswered on December 31, 2020 01:30 AM
We have to escalate this as a bug to the backend team. Please check the link below for the updates.
https://www.jotform.com/answers/2794110
Thanks
-
Yau_CAnswered on December 31, 2020 09:45 AM
Hi AaronChan,
I have modified my prototype for you with predefined course date: https://form.jotform.com/203638194221957
You can define your course date behind the scenes:
I understand that you need to protect the privacy of your user and only want to allow them to enter the month and year of the date of birth. You could do so by providing description as an instruction for the user to follow.
Best,