Welcome, Guest
Username: Password: Remember me

TOPIC: year calculation

year calculation 1 year 8 months ago #92127

  • ocean
  • ocean's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 18
  • Karma: 0
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: 1 year 8 months ago by ocean.
The administrator has disabled public write access.

Re: year calculation 1 year 8 months ago #92128

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1112
  • Thank you received: 250
  • Karma: 78
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Last Edit: 1 year 8 months ago by Ben_V.
The administrator has disabled public write access.

Re: year calculation 1 year 8 months ago #92129

  • ocean
  • ocean's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 18
  • Karma: 0
Can I put this in also in the title of a question?
The administrator has disabled public write access.

Re: year calculation 1 year 8 months ago #92130

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1112
  • Thank you received: 250
  • Karma: 78
yes... try it!
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.
The following user(s) said Thank You: ocean

Re: year calculation 1 year 8 months ago #92131

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1112
  • Thank you received: 250
  • Karma: 78
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.

Re: year calculation 1 year 8 months ago #92133

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1112
  • Thank you received: 250
  • Karma: 78
and maybe it's more convenient to use the Expression Manager:

Year:
{date("Y")}

Year+1:
{(date("Y")+1)}
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.116 seconds
Donation Image