Adobe 12001196 - Acrobat - Mac Manual page 78

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

Advertisement

A Short Acrobat JavaScript FAQ
A
How do I use date objects?
To convert a Date object into a string, the
in conversion of the Date object to a string,
the date should be formatted.
/* Example of util.printd */
var d = new Date(); // Create a Date object containing the current date
/* Create some strings from the Date object with various formats with
** util.printd */
var s = [ "mm/dd/yy", "yy/m/d", "mmmm dd, yyyy", "dd-mmm-yyyy" ];
for (var i = 0; i < s.length; i++) {
}
The output of this script would look like:
Format mm/dd/yy looks like: 01/15/99
Format yy/mm/dd looks like: 99/1/15
Format mmmm dd, yyyy looks like: January 15, 1999
Format dd-mmm-yyyy looks like: 15-Jan-1999
N
O T E
78
/* print these strings to the console */
console.println("Format " + s[i] + " looks like: "
+ util.printd(s[i], d));
(TIP) Given the ever increasing length of the human lifespan and the lessons we've
:
learned from Y2K coding issues, it is advised that you output dates with a four digit
year to avoid ambiguity.
printd
of the
Util Object
allows an exact specification of how
printd
is used. Unlike the built-
Acrobat JavaScript Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Acrobat 6.0

Table of Contents