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

Javascript Date Display

homa
Registered: Feb 6 2007
Posts: 4

Is it possible to display the date 2/6/07 as 6th February 2007? It is the date that automatically enters when the pdf is opened. It's not an editable date field. Thanks.

My Product Information:
Acrobat Pro 7, Macintosh
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi homa,

There are many date and time formats that can be used with Acrobat JavaScript, including 6 February 2007. The Document Level JS below is taken directly from a series of articles at JavaScript Corner called "Working with Times and Dates in Acrobat JavaScript" except I changed the date format to what you are asking for and of course this example works for a field with the name DateField (substitute with your field name).

var fld = this.getField("DateField");fld.value = util.printd("dd mmmm yyyy",new Date()); 
Here are links to the articles- if you are going to work with dates and times in PDF forms (almost everyone does) you should give them a read.

[url=http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part1]http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part1[/url]

[url=http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part2/index.php]http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part2/index.php[/url]

[url=http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part3/index.php]http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part3/index.php[/url]

Hope this is helpful.

Dimitri Munkirs
WindJack Solutions
[url=http://www.windjack.com]www.windjack.com[/url]