Page:123

## Re: Calculate age in an Equation type question, using Date of Birth 1 year 2 months ago #85320

 Ben_V NOW ONLINE Platinum Lime Posts: 869 Thank you received: 175 Karma: 60 Very nice solution... Maybe the improvment could be to get it working with the 2 questions in a same group I attach the sample survey I've created to make a try. Thank you to share... Ben/ Attachments: Dateofbirth_EM.lss (17KB) Benoît goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche) goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar) goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de... The administrator has disabled public write access.

## Re: Calculate age in an Equation type question, using Date of Birth 10 months 3 weeks ago #91050

 PawsInMotion OFFLINE Fresh Lemon Posts: 1 Karma: 0 These have all been incredibly helpful! Thank you! Here's a trick I'm trying to figure out though (without knowing perl or much scripting at all): How do I show year and month (and, optionally, days) from birth as chosen in the previous question. Some of my clients aren't a year old yet (dogs) or are a year and some months. I appreciate the help. I'll keep noodling with this code. At least I figured out that 'floor' means to round the answer. {floor((time() - mktime(0,0,0,substr(DateofBirth,5,2),substr(DateofBirth,8,2),substr(DateofBirth,0,4)))/(365.25*24*60*60))} The administrator has disabled public write access.

## Re: Calculate age in an Equation type question, using Date of Birth 10 months 3 weeks ago #91155

 tfj OFFLINE Expert Lime Posts: 80 Thank you received: 6 Karma: 5 PawsInMotion: The code I used is modular in the sense that you can substitute values in it to come up with whatever type of date measurement you need. For instance, instead of using the following for years: {floor((time() - mktime(0,0,0,substr(DateofBirth,5,2),substr(DateofBirth,8,2),substr(DateofBirth,0,4)))/(365.25*24*60*60))} you can change it to: {floor((time() - mktime(0,0,0,substr(DateofBirth,5,2),substr(DateofBirth,8,2),substr(DateofBirth,0,4)))/(24*60*60))} for the number of days. From there, you could use Equation-type questions to come up with months and days, etc. I tested this on a couple of cases and they seemed okay. Please let me know if your experience is different. tfj The administrator has disabled public write access.

## Calculate age in an Equation type question, using Date of Birth 5 months 22 hours ago #97877

 DWS OFFLINE Senior Lime Posts: 45 Thank you received: 1 Karma: 1 the example works fine... but if yo hide the question then you can't use the value on following questions The administrator has disabled public write access.
 Page:123
Moderators: DenisChenu, ITEd
Time to create page: 0.108 seconds