Comparing dates

More
2 months 1 week ago - 2 months 1 week ago #173757 by DB1324
DB1324 created the topic: Comparing dates
Hi there,


We have a questionnaire which is concerned with a participant's activity over a seven day period.

The participant agrees to take part in our programme, and are enrolled. We create the participant record and token, with an additional attribute 'DateJoined'. This records the date they enrolled, which is likely to be different to the date we added them to LimeSurvey.

We then ask that the participant completes our questionnaire seven days after we enrolled them. We have a field called StartDate, and we need to validate this to ensure it is seven days after DateJoined. We also want to calculate EndDate, which would be six days after StartDate.

Is this possible?


For the EndDate, this works for calculating today's date + 1 week: Week ending: {date('d/m/Y' , time()+604800)} but I can't figure out how to adapt it to reference an existing field.

Any pointers as to how I might (a) validate the StartDate, and/or (b) calculate the EndDate, would be very, very much appreciated.

(We are running Version 2.65.1+170522)

Thank you
Last Edit: 2 months 1 week ago by DB1324.

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago - 2 months 1 week ago #173766 by DenisChenu
DenisChenu replied the topic: Comparing dates
Did you try {strtotime(StartDate)} ?

Something like this : {strtotime("now") > (strtotime(StartDate)+604800)} : to have a boolean

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 2 months 1 week ago by DenisChenu.
The following user(s) said Thank You: DB1324

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #173771 by DB1324
DB1324 replied the topic: Comparing dates
Thanks DenisChenu, a slight addition to that worked:

date('d/m/Y',strtotime(StartDate)+604800)

Thanks again for your help.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!