Skip to main content
Nintex Community Menu Bar

I am trying to auto populate a date field with the value same date but 1 year from now. 

‘Single Specified Value’ doesn’t have the option > n days from today or weeks or years

So opted for ‘Result of a Formula’ but can’t seem to find the proper formula format to do “Today() + 365 days” .  Could someone please advise?

Did try playing with this > DATE_ADD(today(), 52, week) but it’s not working

thank you

 

 

Date fields should be just text strings with the format “YYYY-MM-DD”

You should be able to do this:

 

(YEAR(TODAY())+1)+"-"+IF(LEN(MONTH(TODAY()))=1,"0","")+MONTH(TODAY())+"-"+IF(LEN(DAY(TODAY()))=1,"0","")+IF(AND(MONTH(TODAY())=2,DAY(TODAY())=29),DAY(TODAY())-1,DAY(TODAY()))

..

In the above example I made February 29th just shown as February 28th instead of March 1st so technically it’s not +365 days, also I guess on leap years adding 365 days might not give quite what you expect in the first place.. Here’s a solution where Feb 29th turns into March 1st of the next year

(YEAR(TODAY())+1)+"-"+IF(LEN(MONTH(TODAY()))=1,"0","")+IF(AND(MONTH(TODAY())=2,DAY(TODAY())=29),"3",DAY(TODAY()))+"-"+IF(LEN(DAY(TODAY()))=1,"0","")+IF(AND(MONTH(TODAY())=2,DAY(TODAY())=29),"01",DAY(TODAY()))

 


Hi @Dominique Bastien has Mark’s response help answer your question?


Hi Dominique,

 

There’s a couple good options for this. If you always need a year from today, then it would be best to use the Default value option on a date field. There’s an option for `n days ago`, and a common trick is to set it to negative so that it is actually days in the future. 

If you needed to do a more dynamic value, like I need 365 days from a given date, then a formula would be better. In that case, it’s something like `DATE_ADD(NOW(), 365, DAY)`

Below is some XML with both options

<skuid__page unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" showheader="false">
<models>
<model id="ui" query="true" datasource="Ui-Only" createrowifnonefound="true">
<fields>
<field id="date" displaytype="DATE" length="255" label="date" ogdisplaytype="TEXT" defaultvaluetype="fieldvalue" defaultValue="N_DAYS_AGO:-365"/>
<field id="formulaDate" displaytype="FORMULA" length="255" label="formulaDate" ogdisplaytype="TEXT" readonly="true" returntype="DATE">
<formula>DATE_ADD(NOW(), 365, DAY)</formula>
</field>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<skuid__table allowColumnFreezing="dragDrop" model="ui" allowHTML="false" uniqueid="sk-1AsP-38385" mode="read" showSaveCancel="false">
<fields>
<field id="date" uniqueid="fi-1AsP-38977"/>
<field id="formulaDate" uniqueid="fi-1AsP-38978"/>
</fields>
<filtering enableSearch="false"/>
<actions/>
<rowActions/>
<massActions/>
<exportProperties useTableColumns="true"/>
<sorting enable="false"/>
<styles>
<spacing top="4" right="4" bottom="4" left="4"/>
</styles>
</skuid__table>
</components>
<resources>
<labels/>
<javascript/>
<actionsequences/>
</resources>
<background/>
<interactions/>
<surfaces/>
</skuid__page>

 


Thank you I see that I needed to use Now() instead of Today() 


Reply