How Do I Use Date Objects; Converting From A Date To A String - Adobe 12001196 - Acrobat - Mac Manual

Javascript
Hide thumbs Also See for 12001196 - Acrobat - Mac:
Table of Contents

Advertisement

With our hierarchy of Name.First, Name.Middle and Name.Last above (and perhaps,
Name.Title if used), we can change the background color of these fields with just two
lines of code instead of six:
var name = this.getfield("Name");
name.fillColor = color.yellow
When using this hierarchy within a JavaScript, remember you can only change appearance
related properties of the parent field and that appearance changes propagate to all
children. You cannot change the field's value. For example if you try the following script:
var name = this.getField("Name");
name.value = "Lincoln";
the script will fail. Name is considered a parent field. You can only change the value of
terminal fields (i.e. a field that does not have children like Last or First). The following
script executes correctly:
var first = this.getField("Name.First");
var last = this.getField("Name.Last");
first.value = "Abraham";
last.value = "Lincoln";

How do I use date objects?

This section discusses the use of Date objects within Acrobat. The reader should be familiar
with the JavaScript Date object and the
Date objects are actually an object containing both a date and time. All references to date
in this section refer to the date-time combination.
N
O T E
N
O T E

Converting from a Date to a String

Acrobat Forms provides several date related methods in addition to the ones provided by
the JavaScript Date object. These are the preferred methods of converting between Date
objects and strings. Because of Acrobat Forms' ability to handle dates in many formats, the
Date object does not always handle these conversions correctly.
Acrobat JavaScript Scripting Guide
All date manipulations in JavaScript, including those methods that have been
:
documented in this specification are Year 2000 (Y2K) compliant.
(TIP) When using the Date object, do not use the getYear() method which
:
returns the current year minus 1900. Instead use the getFullYear() method
which always returns a four digit year. For example,
var d = new Date()
d.getFullYear();
A Short Acrobat JavaScript FAQ
Util Object
functions that process dates. JavaScript
How do I use date objects?
A
77

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Acrobat 6.0

Table of Contents