- Posts: 29
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Date - 60 days (dynamic)
- rbernhardthki
- Topic Author
- Offline
- Junior Member
Less
More
6 years 2 months ago #164380
by rbernhardthki
Date - 60 days (dynamic) was created by rbernhardthki
Hi,
I have a survey where I need to display different text + admin email based on the below:
IF {CommissionDate} >= today's date - 60 days, TRUE, FALSE
I found that to get today's date i can use {date('d/m/Y')} but if I add -60 at the end it displays as "NAN".
I also tried: {(date('d')-60)+'/'+(date('m'))+'/'+(date('Y'))} which is displayed as -39/02/2018.
Any ideas? (I suck at PHP and java, so please don't suggest any of those)
I have a survey where I need to display different text + admin email based on the below:
IF {CommissionDate} >= today's date - 60 days, TRUE, FALSE
I found that to get today's date i can use {date('d/m/Y')} but if I add -60 at the end it displays as "NAN".
I also tried: {(date('d')-60)+'/'+(date('m'))+'/'+(date('Y'))} which is displayed as -39/02/2018.
Any ideas? (I suck at PHP and java, so please don't suggest any of those)
The topic has been locked.
- Deusdeorum
- Offline
- Senior Member
Less
More
- Posts: 72
- Thank you received: 17
6 years 2 months ago #164384
by Deusdeorum
Replied by Deusdeorum on topic Date - 60 days (dynamic)
What format is ComissionDate? Is it a question?
The topic has been locked.
- rbernhardthki
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 1
6 years 2 months ago #164385
by rbernhardthki
Replied by rbernhardthki on topic Date - 60 days (dynamic)
Commission date is a question in 'dd/mm/yyyy' format
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12916
- Thank you received: 3975
6 years 2 months ago - 6 years 2 months ago #164386
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Date - 60 days (dynamic)
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 6 years 2 months ago by Joffm.
The following user(s) said Thank You: rbernhardthki
The topic has been locked.
- rbernhardthki
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 1
6 years 2 months ago #164389
by rbernhardthki
Replied by rbernhardthki on topic Date - 60 days (dynamic)
Thank you! Works great
The topic has been locked.
- rbernhardthki
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 1
6 years 2 months ago #164392
by rbernhardthki
Replied by rbernhardthki on topic Date - 60 days (dynamic)
One more thing. Do you also know how to use this validation to show a question?
Basically I need to show a question which will say: Sorry, not covered under warranty if the commission date is >= today-60
Thanks
Basically I need to show a question which will say: Sorry, not covered under warranty if the commission date is >= today-60
Thanks
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12916
- Thank you received: 3975
6 years 2 months ago #164393
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Date - 60 days (dynamic)
Set Relevance of that question to
ComDate>date("Y-m-d",strtotime("-60 days"))
But is this correct?
Joffm
ComDate>date("Y-m-d",strtotime("-60 days"))
But is this correct?
If it is within the last 60 days it is NOT covered?Sorry, not covered under warranty if the commission date is >= today-60
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Deusdeorum
- Offline
- Senior Member
Less
More
- Posts: 72
- Thank you received: 17
6 years 2 months ago - 6 years 2 months ago #164394
by Deusdeorum
Replied by Deusdeorum on topic Date - 60 days (dynamic)
Just use your same equation in the "relevance equation" of the question. It will be validated as a bool, so something like (ComissionDate >= date("Y-m-d",strtotime("-60 days"))) or however your equation ended up like !
Last edit: 6 years 2 months ago by Deusdeorum.
The topic has been locked.
- rbernhardthki
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 1
6 years 2 months ago #164395
by rbernhardthki
Replied by rbernhardthki on topic Date - 60 days (dynamic)
Attachments:
The topic has been locked.
- Deusdeorum
- Offline
- Senior Member
Less
More
- Posts: 72
- Thank you received: 17
6 years 2 months ago #164396
by Deusdeorum
Replied by Deusdeorum on topic Date - 60 days (dynamic)
Try removing the if-statement, (INSERTANS:669123X299X2380<=date('d/m/Y', strtotime("-60 days")))
The topic has been locked.
- rbernhardthki
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 1
6 years 2 months ago #164397
by rbernhardthki
Replied by rbernhardthki on topic Date - 60 days (dynamic)
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
6 years 2 months ago #164398
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 Date - 60 days (dynamic)
Or convert it to epoch time. So, something like this for the relevance equation:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.