Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Comparing dates

  • DB1324
  • DB1324's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 6 months ago - 5 years 6 months ago #173757 by DB1324
Comparing dates was created by DB1324
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: 5 years 6 months ago by DB1324.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago - 5 years 6 months ago #173766 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
Last edit: 5 years 6 months ago by DenisChenu.
The following user(s) said Thank You: DB1324
The topic has been locked.
  • DB1324
  • DB1324's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 6 months ago #173771 by DB1324
Replied by DB1324 on topic Comparing dates
Thanks DenisChenu, a slight addition to that worked:

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

Thanks again for your help.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose