Answered
Hi,
I have a form where end-user enter a date, and I must populate 10 fields that repeat the starting date adding one month in each 10 fields :
01/24/2010
02/24/2010
03/24/2010
and so on…
After searching the forum I found some useful tutorials made by Thomp and gkaiseril, and now I can add 30 days, my script works fine.
My script is :
event.value = ""; // Get the string date from the current date field var strDate = this.getField("prelev.IDservices_form-200911_date").value; if(strDate !== "") { var oDate = util.scand("d mmmm yyyy",strDate); if(oDate) { // Calculate 30 days in milliseconds var Dday = 30 * 24 * 60 * 60 * 1000; // Create a new date object so we can format it oDate = new Date(Dday + oDate.getTime()); event.value = util.printd("d mmmm yyyy", oDate); } }
But I didn't understand how I can add one month instead of 30 days, since result isn't exactly the same and I need the day to always be the same : only the month number (and the year if needed) must change…
Can someone help me ?
Please, please, please…
[i](Please, be lenient since english isn't my native langage...)[/i]
;-)
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com