This is an offshoot of the thread on the date bug. Since it is a different topic, I thought it deserved its own thread.
I want to build a date, but I don't see any constructor in FormCalc to do that. Is this just my missing it or doesn't it exist.
Using Date2Num I can extract the pieces of a date (month, day, year). Because of the date bug I can't do the simple of adding one to a date without tons of scripting behind it. Each of the date delimiters has multiple options (mm,dd,yy or m,dd,yy or mm,d,yy or m,d,yy or mm,dd,yyyy or m,dd,yyyy or mm,d,yyyy or dd,mm,yy or m,dd,yyyy etc. And each of these apply to period, comma, dash, slash or space delimiters. A script could run to hundreds of lines to accommodate all this.
I was hoping to have a work-a-round by extracting the pieces and ignoring the delimiters and permutations. The problem is building the date from the pieces.
One format in the docs is Num2Date("12/31/12", "MM/DD/YY") so I was hoping to create a variable with that and use it. But it didn't work.
Any ideas on:
1) other utilities that will convert numbers into a date?
2) a correct format for this utility?
Here is the code I have so far:
var day = Num2Date(monAsNum, "D");
var month = Num2Date(monAsNum, "M");
var year = Num2Date(monAsNum, "Y");
var redone = Concat(month,"/",day+1,"/",year);
var rebuild = Num2Date(redone,"MM/DD/YYYY");
$host.messageBox(Concat("Testing **Day: ", day, " Month: ", month, " Year: ", year, " Rebuilt: ", rebuild));
I also concatenated in a double quote to the string start and end, but it still didn't work.
I'm using LiveCycle Designer and most of the java script isn't working. For example,
var rightNow = Date(this.rawValue);
xfa.host.messageBox(rightNow);
var year = rightNow.getYear().value;
xfa.host.messageBox(year);
var month = rightNow.getMonth().value;
xfa.host.messageBox(mouth);
var day = rightNow.getDate().value;
xfa.host.messageBox(day);
will display "rightNow" and nothing else. There is no javascript console either (thus all the message boxes).
Hi Jerry,
1. Calculating Summaries,
util.printd(...)
and
util.scand(...)
http://acrobatusers.com/tutorials/date_time_part1
Tarek.
--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To post to this group, send email to live...@googlegroups.com.
To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livecycle?hl=en.
The date/time field returns completely different results depending on the input format which is the initial problem. I changed the deprecated "getYear" to "getFullYear" with no difference.
Since I'm using Adobe LiveCycle Designer ES2 9.0.0 I may not have access to the things you see.
The console window is in Acrobat, not Designer.
Once you have the console open then you can use console.println() instead of xfa.host.messageBox() for debugging...much easier!