I currently have a form that calculates a person's age in full years using the following script (FormCalc):
if ( not Row1.DateTimeField1 <> Null ) then
var DateTimeField1 = Date2Num( Row1.DateTimeField1, "YYYY-MM-DD" )
var currentDate = Date()
var years = ( currentDate - DateTimeField1 ) / 365
$ = Floor ( years )
$ = ""
I need to change this formula to instead calculate the age in years and months. For instance, if the user inputs their date of birth as 01/15/1979, then the output field would read, 33.11, for 33 years, 11 months.
I know that I can remove the floor function to get partial years, but that results in the partial year dividing by 10, not 12. I tried that with the above date and the result was 33.9...