How to calculate DUE DATE in Adobe Acrobat with PDF Javascript
Ғылым және технология
In this video, I'm going to show you How you can calculate DUE DATE in PDF Form and PDF Document with PDF JavaScript. I'm using Adobe Acrobat Pro DC 2023.
First, we need to create two Javascript for calculating the due dates of a certain number of days and Months. I have shown every single step in the video, just follow as shown.
________________________________________________________________________
If you still facing any problems, Let me know in the comment box down below.
For more videos, Subscribe to our channel: / @sarservices
________________________________________________________________________
How to create a dependent Dropdown menu in adobe acrobat
• How to create Multiple...
Create an auto-calculating PDF INVOICE in adobe acrobat
• Create PDF Invoice Wit...
How to add checkboxes and run Javascript in Adobe Acrobat
• How to add checkbox an...
________________________________________________________________________
JAVASCRIPT:
For Days:
var d = util.scand("dd/mm/yyyy", this.getField("Date").valueAsString);
var theTime = d.getTime () ;
var oneDay = theTime + 5*24*3600*1000;
var dd = new Date(oneDay);
event.value = util.printd("dd mmmm yyyy", dd);
For Months:
var d = util.scand("dd/mm/yyyy", this.getField("Date").valueAsString);
var cMonth = d.getMonth() + d.getFullYear() * 12;
d.setMonth(d.getMonth() + 1);
var diff = d.getMonth() + d.getFullYear() * 12 - cMonth;
if (diff != 1) {
d.setDate(0);
}
event.value = util.printd("dd mmmm yyyy", d);
Пікірлер: 13
Thank you very much for this, it is very helpful. Is there a possibility to set the date to the previous Friday if it falls on a weekend?
@sarservices
3 ай бұрын
It might be challenging, but yes, we can do it. We just need to figure out the logic for this code.
Very helpful tutorial also youtube channel
Hi. First off thanks so much for this video! In my PDF form I have a start date box and and an end date box needs to be a year from start. I followed your guidance but it is only giving me a year from today's date. I need it to follow whatever the start date will be in the previous box. What should I change ?
@sarservices
6 ай бұрын
If you need a due date after One year, then this script will help you: var startDate = this.getField("Start_Date").value; var endDate = util.scand("mm/dd/yyyy", startDate); endDate.setDate(endDate.getDate() + 365); this.getField("End_Date").value = util.printd("mm/dd/yyyy", endDate);
How do I make it calculate into a text box 90 days from "Date 1" entered into another area?
Can you make a video on auto calculation invoice?
@sarservices
Жыл бұрын
Video very soon Don't forget to like and subscribe to our channel.
How do i edit the script to give me one month before, like - 1 month?
@sarservices
Жыл бұрын
Hello Alivia, Simply just replace this line. " d.setMonth(d.getMonth() - 1); "
Kindly give me script for date after 18 y
@sarservices
Жыл бұрын
Just replace the start date field name with yours and Don't forget to like and subscribe to my channel. Thanks for watching. For 18 years. ----------------------------------------------------------------------------------- var cDate = this.getField("date").value; if (cDate) { var d1 = new Date(); d1 = util.scand("dd-mmm-yyyy", cDate); d1.setFullYear(d1.getFullYear() + 18); // this adds eighteen years d1.setDate(d1.getDate() - 1); // this subtracts one day event.value = util.printd("dd-mmm-yyyy", d1); }
@aymansayed785
Жыл бұрын
@@sarservices many thanks Appreciate your help