- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Find the difference between 2 dates using only months in Limesurvey
- Lilit
- Topic Author
- Offline
- New Member
Less
More
3 years 7 months ago - 3 years 7 months ago #204578
by Lilit
Find the difference between 2 dates using only months in Limesurvey was created by Lilit
Hello! I have two date variables. The first one is the day of the interview and the other is a person's date of birth.
I am trying to find the number of days between the day of the interview and the birth date so that if I have dates of birth of multiple people, I can choose the one whose birthday is the closest to today (it is a way to do a random selection). For instance, if the person was born on 25/08/1992 and today is 27/08/1992, the output is supposed to be 2 days (meaning that we used only days and months). How can I do that in Limesurvey?
Thanks in advance!
I am trying to find the number of days between the day of the interview and the birth date so that if I have dates of birth of multiple people, I can choose the one whose birthday is the closest to today (it is a way to do a random selection). For instance, if the person was born on 25/08/1992 and today is 27/08/1992, the output is supposed to be 2 days (meaning that we used only days and months). How can I do that in Limesurvey?
Thanks in advance!
Last edit: 3 years 7 months ago by Lilit.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
3 years 7 months ago #204585
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Find the difference between 2 dates using only months in Limesurvey
I'm not sure I understand "using only months " but you can use the strtotime() function in an Equation type question to find the difference between dates.
Something like this will give the difference in days between the current date and a value entered in a Date type question:
Sample survey attached:
Something like this will give the difference in days between the current date and a value entered in a Date type question:
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12931
- Thank you received: 3978
3 years 7 months ago #204588
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Find the difference between 2 dates using only months in Limesurvey
Do you want to replicate this selection procedure "Ask the person whose birthday anniversary is next"?
This would mean that the year is not relevant.
Joffm
This would mean that the year is not relevant.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.