500 pts. Making text field show 2 weeks ahead of current date


I have a text field in an acrobat 6 file called "today" and I want it to show 2 weeks ahead of the current date in MM/DD/YYYY format. Below is a solution given to me by khkremer. Can anyone add to this answer or give me another solution?

select the Form tool: "Tools>Advanced Editing>Forms>Text Field Tool" and draw a rectangle on your PDF document. This will bring up the preference dialog for this form field. Select the "General" Tab and specify "Today" as the field name. Look around on the UI, select all the tabs, but you don't need to make any more changes here. Close the dialog. Select "Advanced>JavaScript>Document JavaScript". Give the script a name (e.g. "OnOpen") and click on the "Add" button. Replace the complete function stub with this line:

this.getField("Today").value = "today's date";

Save the file, close it and reopen it. YOu will now have the string "today's date" in your field. This information plus the first link that I provided should get you started with adding date information to your documents. You can have multiple fields with the same name. This will then add the date to all of these in one operation.
Here is the link khkremer  made reference to, though I cannot make heads or tails of it.

Your help on this is greatly apprieciated!

Who is Participating?
Karl Heinz KremerCommented:
Instead of the simple assignment from my sample, use this JavaScript instead:

var dateField = this.getField("Text1");  // <-- Replace this with the field name for your date field
var today = new Date();

var newDateValue = today.valueOf();   // converts today to a number that we can calculate with

newDateValue += (14 * 1000 * 60 * 60 * 24);  // add 14 days
                                      // 1000 miliseconds times 60 seconds times 60 minutes
                                      // times 24 hours times 14
var adjustedDate = new Date(newDateValue);  // create a new date based on the newDateValue variable
dateField.value = util.printd("mm/dd/yyyy", adjustedDate);       // format and assign the new date

coma12Author Commented:
Here is a link to the pdf that I want to add the 2 weeks from current date text field to. The date is manually added right now, every day - ugggh.

Also if I will need to make the date in red.


Karl Heinz KremerCommented:
Were you able to add the text field to the document as I suggested in your earlier question?
coma12Author Commented:

Thank you so much!!!

I was hoping you were scanning the acrobat section.

Once again you came through like a champ and saved the day!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.