开发者

Adding a Date Range

I have an Adobe time sheet where I need to populate all of the date fields based on a beginning date.

For instance if I enter 08-01-11 I need th开发者_如何学Ce end date to automatically add 28 days.

Then below, I need all the date fields in the column to list 08-01-11, 08-02-11, etc. The first and last entry should equal the start date and end date.

I have researched for the last few hours but I am unable to find a solution.

Any help would be greatly appreciated.

Thanks.

Tom M.


I did a quick experiment. (I used 7 dates instead of 28 to reduce repetitive work.)

First I created a simple document in Word with a table and some static text labeling the different fields and leaving room for the text fields.

Next, I print to PDF and open the PDF in Acrobat. Here I add 9 text fields. 2 for the start and end dates and 7 for the consecutive dates. I call them startDate, endDate, date1, ..., date7. I set the format of all fields to Date. I make all fields except startDate read-only.

Next, I go the Calculate tab of the endDate field and enter the following JavaScript code (Custom calculatation script):

var f = this.getField("startDate");
var d = new Date(f.value);
d.setDate(d.getDate()+6); 
event.value = util.printd("mm/dd/yyyy", d);

I do something similar for the date1, ..., date7 fields.

You can download the result here: http://download.tallcomponents.com/timesheet.pdf

Frank Rem, http://www.tallcomponents.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜