Hi all,
I have a simple Designer ES (8.2) form that I'm trying to make work but I cannot make it calculate. Such a simple problem, I got it to work on an Acroform but I can't get it to work in Designer.
I need to determine how long a rehired employee was gone. Using Thom's excellent [url=http://www.acrobatusers.com/tutorials/2006/date_time_part1]Date & Time tutorials[/url], I was able to craft the following code when given a Termination Date and the Rehire Date:
var strStart = this.getField("RehireDate").value;
var strEnd = this.getField("TermDate").value;
if(strStart.length && strEnd.length)
{
var dateStart = util.scand("mm/dd/yyyy",strStart);
var dateEnd = util.scand("mm/dd/yyyy",strEnd);
var diff = dateStart.getTime() - dateEnd.getTime();
var oneDay = 24 * 60 * 60 * 1000;
var days = Math.floor(diff/oneDay);
event.value = days;
}
else
event.value = 0;
But I am having difficulty translating this into something Designer recognizes. Here's where I'm at so far:
var strStart = EmpInfoGroup.dtmRehireDate1.rawValue;
var strEnd = EmpInfoGroup.dtmTermDate1.rawValue;
if (dtmStart.length && dtmEnd.length)
{
var dateStart = util.scand("mm/dd/yyyy",strStart);
var dateEnd = util.scand("mm/dd/yyyy",strEnd);
var diff = dateStart.getTime() - dateEnd.getTime();
var oneDay = 24 * 60 * 60 * 1000;
var days = Math.floor(diff/oneDay);
event.value = days;
}
else
event.value = 0;
Any help would be greatly appreciated.
Also look at the variable names you are using.
Have you looked at using FormCalc?
The date and time fucntions and coding maybe easier in FormCalc.
George Kaiser