Search code examples
dateinfopath

How to get current and next year in infopath


I have a field (todaysDate) which has the following function: today().

I am displaying that value in a field (textbox) with the function: substring(todaysDate, 1, 4) which only gives the year.

I have another field (textbox) which I would like to show the value for the following year.

So for example:

`todaysDate`: `2015-10-21`
`textbox`: `2015`
`textbox`: `2016`

Solution

  • To get the current year I added a new field:

    todayYear: substring(now(), 1, 4)
    

    To get next year I added another new field:

    nextYear: sum(todayYear) + 1