year calculation

More
4 years 8 months ago - 4 years 8 months ago #92127 by ocean
ocean created the topic: year calculation
Hi,

how can I use in the questions the actual year.
and how can I calculate the next year with it.

for example:

Are you also helping the next season {year} till {year+1}

Last Edit: 4 years 8 months ago by ocean.

Please Log in to join the conversation.

More
4 years 8 months ago - 4 years 8 months ago #92128 by Ben_V
Ben_V replied the topic: year calculation
Hello,

The following javascript snippet can be use to display the current year:
<script type="text/javascript">
    var year=mydate.getFullYear();
    document.write(year);
</script>
... and this one to display next year:
<script type="text/javascript">
    var year=mydate.getFullYear();
    document.write(year+1);
</script>
Just copy each one where needed

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 4 years 8 months ago by Ben_V.

Please Log in to join the conversation.

More
4 years 8 months ago #92129 by ocean
ocean replied the topic: year calculation
Can I put this in also in the title of a question?

Please Log in to join the conversation.

More
4 years 8 months ago #92130 by Ben_V
Ben_V replied the topic: year calculation
yes... try it!

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: ocean

Please Log in to join the conversation.

More
4 years 8 months ago #92131 by Ben_V
Ben_V replied the topic: year calculation
oups sorry I did, a little mistake :silly:
<script type="text/javascript">
var mydate=new Date,year=mydate.getFullYear();
document.write(year+1);
</script>
 
<script type="text/javascript">
var mydate=new Date,year=mydate.getFullYear();
document.write(year);
</script>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
4 years 8 months ago #92133 by Ben_V
Ben_V replied the topic: year calculation
and maybe it's more convenient to use the Expression Manager:

Year:
{date("Y")}

Year+1:
{(date("Y")+1)}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now