These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Automatically Calculating a Date

Bryan_Sims
Registered: Nov 5 2008
Posts: 2

I am creating a form and I want to create a field that automatically calculats the information based on the information provided in another field. Specifically, what I am looking for is a script that will do the following: Field 1 is a date. For field 2, I would like the field to automatically calculate the date 3 days before the date entered in Field 1.

I know that you can create calculated fields in Acrobat, but I don’t know how to create the calculation script for what I want. I was hoping that some Acrobat expert has a suggestion for me.

My Product Information:
LiveCycle Designer, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Bryan_Sims,

Here is a tutorial from the Learning Center here at AUC on calculating with dates and times in PDFs-

http://www.acrobatusers.com/tutorials/2006/date_time_part2

There is a link in the tutorial for a PDF you can download and examine the scripts used. Also, this is one part of a 3 part series on working with dates and times in Acrobat- good reading if you want to learn more.

Hope this helps,

Dimitri
www.pdfscripting.com
www.windjack.com
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Do you have the FormCalc Reference? It has a whole section on functions for date calculations. You'll find several document here:

http://kb2.adobe.com/cps/330/330467.php

There are also several posts on this forum on performing date calculations. Have you looked at any of these?

Here's an article on traditional JavaScript Date calculations in AcroForms, but everthing also applies to LC forms:

http://www.acrobatusers.com/tutorials/2006/date_time_part1

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script