Skip to main content
New Participant
October 24, 2020
Question

add days to a date

  • October 24, 2020
  • 3 replies
  • 2783 views

I am trying to add 10 days to a date which a user enters into a form. I have created a date field "Date1", I have created a Date field "Date2". In the Calculate tab , under Custom Script, i placed the following code

var s1 = this.getField("Date1").valueAsString;

if (s1=="") event.value = "";

else {

    var d1 = util.scand("dd/mm/yyyy", s1);

    d1.setDate(d1.getDate()+30);

    event.value = util.printd("dd/mm/yyyy", d1);

}

It does not work (I took this code from a previous post)
I have tried simple calculated fields like adding two numbers together, and i can get that to work

This topic has been closed for replies.

3 replies

New Participant
October 24, 2020

Got it, thank you, my error was inconsistant formatting between the two fields

 

 

 

try67
Community Expert
October 24, 2020

Change +30 to +10... Also, check the JS Console for errors.

Nesa Nurani
Community Expert
October 24, 2020

Did you format fields as dd/mm/yyyy ?

New Participant
October 24, 2020
I had changed it, sorry did not update the post, I did mm/dd/yy

Get Outlook for iOS