When I enter a date prior to 1930 it shows up as 2000 for example 1929 would be 2029. How do I fix this? I have a form where ages are calculated and when a person is born prior to 1930 it will not calculate properly.
You would have to set the spilt year in your code, so the age calculation script would be something like ... the bit in bold sets the split year to 20. This would fix your 01-11-17 with birth date of 01-26-29 problem above. But if the correct answer to 01-24-17 with birth date of 01-24-16 was 101 then you still have a problem. Is there a minimum age?
if (HasValue(DOB) and Date2Num(DOB.formattedValue, "MM-DD-YY") > 0) then
if (HasValue(form1.Page1.subPage1.subEvent.Arrived) and Date2Num(form1.Page1.subPage1.subEvent.Arrived.formattedValue, "MM-DD-YY") > 0) then
var Arrived_ = Date2Num(form1.Page1.subPage1.subEvent.Arrived.formattedValue, "MM-DD-YY")
If you are using a two digit year, then you are going to have to set a century split year. The default, as you have found, is 30. Anything before 30 is treated as in the 20th century and anything after is treated as the 19th century.
If you enter "01-24-17" as the arrival date and "01-24-16" as the DOB is the age 1 or 101?
I think you can upload your form to dropbox, docdroid, wetransfer, etc so it can be viewed (you'd have to link the file). Your date field has a default pattern. The pattern = the way your date is displayed (ie. MMDDYY).
To view this select your 'Date Field' object then make sure you're under the Field tab to then select 'Patterns':
When I enter the current date and then a birth date to calculate the age and the birth date is before 1930 it gives me a negative number. For example if I enter 01-11-17 and the birth date of 01-26-29 it gives an age of -13.
It is currently in a text field but gives the same result in a date field.
I can send you the form if need be, but I guess I can't attach an attachment through here.