The following code is supposed to return a two digit year. However I am getting the two digit year with an "in" as a suffix.
var nd = new Date();
var z = nd.getFullYear();
var y = z.toString();
var x = y.substr(2, 3);
app.alert("Variable nd = " + nd + "\n" + "Variable z = " + z + "\n" + "Variable y = " + y + "\n" + "Variable x = " + x);
the alert box upon showing up says:
Variable nd= Tues Nov 06 2012 11:51:11 GMT -0800 (Pacific Standard Time)
Variable z = 2012
Variable y = 2012in
Variable x = 12in
What is going on? "y" should equal 2012 as a string value and "x" 12 as a string value. Where is the "in" suffix coming from? Thanks.
Views
Replies
Total Likes
Hi,
The problem you are having is because x and y are names reserved for the XFA object, so if this code was executing in button y would return you the y co-ordinate of the button, which must be in inches in your system.
Some other common names are w, h and index.
Regards
Bruce
Views
Replies
Total Likes
Thank you Bruce.
var nd = new Date();
var a = nd.getFullYear();
var b = a.toString().slice(2)
document.write("Variable nd = " + nd + " " + "Variable a = " + a + "" + "Variable b = " + b + "");
Views
Replies
Total Likes