Tips & Tricks

Displaying the current Date

May 17, 2000

Advertisement
Advertisement
 

By using Acrobat Form Fields it is possible to display the current system date in a field, best of all this field will dynamically update even in Acrobat Reader.

Add a Form field of type Text to the page and call it 'mydate' (see Figure 1.1).


Figure 1.1

Now select the 'Set Page Action...' from the 'Document' menu (see Figure 1.2).


Figure 1.2

Select 'Page Open' and click the 'Add' button (see Figure 1.3).


Figure 1.3

From the list of 'Types' select Javascript and click the 'Edit' button (see Figure 1.4).


Figure 1.4


Figure 1.5

Add the following code to Page Open Action (see Figure 1.5):

var newdate = new Date(); 
var thisfieldis = this.getField("mydate");  

var theday = util.printd("dddd",newdate); 
var thedate = util.printd("d",newdate); 
var themonth = util.printd("mmmm",newdate);
var theyear = util.printd("yyyy",newdate);  

thisfieldis.value = theday + " " + thedate + ", " + themonth + " " + theyear ; 

Now whenever the page is opened it will display the current system date.

Note: Experiment with the 'dddd', 'mmmm', 'yyyy' to get different date formats.

Copyright Dave Wraight & Planet PDF. No unauthorised reproduction, distribution or publication permitted.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.