scand
Parameters: cFormat, cDate
Returns: date object
4.0
This method converts the supplied date,
cDate,
into a JavaScript date object according to rules
of the supplied format string,
cFormat. cFormat
uses the same syntax as found in
printd.
This
routine is much more flexible than using the date constructor directly.
/* Turn the current date into a string. */
var cDate = util.printd("mm/dd/yyyy", new Date());
console.println("Today’s date: " + cDate);
/* Parse it back into a date. */
var d = util.scand("mm/dd/yyyy", cDate);
/* Output it in reverse order. */
console.println("Yet again: " + util.printd("yyyy mmm dd", d));
Note:
Given a two digit year for input,
scand
resolves the ambiguity as follows: if
the year is less than 50 then it is assumed to be in the 21st century (i.e. add
2000), if it is greater than or equal to 50 then it is in the 20th century (add
1900). This heuristic is often known as the
Date Horizon.
Acrobat Forms - JavaScript Object Specification
55
Index Bookmark Pages Text
Previous Next
Pages: Index All Pages
This HTML file was created by VeryPDF PDF to HTML Converter product.