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.

Related Products at PDF Store

PitStop Professional

The industry standard that combines preflight, interactive editing and automated correction capabili... View full product details
Download free demo

Nitro PDF Professional

Nitro PDF Professional, your PDF creation and editing product. Priced at $99, Nitro PDF Pro is the m... View full product details
Download free demo

Adobe? Acrobat? & PDF Software

The No.1 PDF and Acrobat software store for tools to create, edit and publish PDF files. Get Nitro P... View full product details
Download free demo

PDF In-Depth Free Product Trials Ubiquitous PDF

Nitro PDF Professional

the perfect PDF product for business and enterprise, combining an extremely competitive price with a...

Download free demo

XpdfViewer

This ActiveX control (OCX) provides a PDF file viewer component, enabling developers to add PDF viewing...

Download free demo

Ubiquitous PDF: PDF eBooks-Library

If you are looking for a good store of PDF content, you could do a lot worse than visiting eBooks-Library.com...

September 03, 2009
Search Planet PDF
more searching options...







Download PDF Creator

Download The Best of Planet PDF volume 2
Planet PDF Newsletter
Most Popluar Articles
Features

Collating PDFs using JavaScript

Despite the numerous benefits, there can be potential issues with the conversion of paper documents into electronic archives. When scanning paper pages into PDF, it's possible to end up with the odd- and even-numbered pages in separate PDF files. It can be very time-consuming to collate them manually, but there is an easier way. Sean Stewart explains.

Featured Product

BCL easyPDF SDK

BCL easyPDF SDK is a set of PDF Programming Libraries designed specifically to help Software Developers / Programmers build and deploy enterprise class PDF applications for corporate wide PDF...

Platinum Sponsor
Create & Edit PDF - Nitro PDF Software

ARTS PDF

Silver Sponsors

PDF-Tools enfocus

QuickPDF: The Unrivaled PDF Developer Toolkit