Skip to main content
Inspiring
March 28, 2022
Answered

CURRENT DATE & DEADLINE DATE

  • March 28, 2022
  • 1 reply
  • 26452 views

Attached is a form I want the deadline to always be the 5th of the upcoming month. e.g., if the current date is 27th of march, the deadline should always be one month ahead. but in this case, the day would always be 5th of the upcoming month. I hope this can be done!

Thanks in anticipation for a quick response.

This topic has been closed for replies.
Correct answer Nesa Nurani

I see you don't have field for deadline date, so create a field I named it "Deadline_Date" and add new document level script using this:

var month = util.scand("dd-mmm-yyyy", new Date());
month.setMonth(month.getMonth() +1);
var str = util.printd("dd mmmm, yyyy", month);
var newDate = "05"+str.slice(2);
this.getField("Deadline_Date").value = newDate;

 

Here is your file with everything above added:

https://drive.google.com/uc?export=download&id=1gm7aW8xUlJx4tbyVimvQ6sW1M9Eybyic 

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
March 28, 2022

I see you don't have field for deadline date, so create a field I named it "Deadline_Date" and add new document level script using this:

var month = util.scand("dd-mmm-yyyy", new Date());
month.setMonth(month.getMonth() +1);
var str = util.printd("dd mmmm, yyyy", month);
var newDate = "05"+str.slice(2);
this.getField("Deadline_Date").value = newDate;

 

Here is your file with everything above added:

https://drive.google.com/uc?export=download&id=1gm7aW8xUlJx4tbyVimvQ6sW1M9Eybyic 

saka5FD5Author
Inspiring
March 28, 2022

Thanks a lot. it worked perfectly