• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

add days to a date

New Here ,
Oct 24, 2020 Oct 24, 2020

Copy link to clipboard

Copied

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

TOPICS
PDF forms

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2020 Oct 24, 2020

Copy link to clipboard

Copied

Did you format fields as dd/mm/yyyy ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2020 Oct 24, 2020

Copy link to clipboard

Copied

I had changed it, sorry did not update the post, I did mm/dd/yy

Get Outlook for iOS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2020 Oct 24, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2020 Oct 24, 2020

Copy link to clipboard

Copied

LATEST

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

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines