I have entered the following to determine the number of days between two dates. The Beginning date field is called Start1, and the end date field is called End1 - the number of days field is called Traveldays1.
var strStart = this.getField("Start1").value;
var strEnd = this.getField("End1").value;
if(strStart.length & strEnd.length)
var Start1 = util.scand("dd/MM/YY",strStart);
var End1 = util.scand("dd/MM/YY",strEnd);
var diff = End1.getTime() - Start1.getTime();
var oneDay = 24 * 60 * 60 * 1000;
var days = Math.floor(diff/oneDay);
event.value = days;
else
event.value = 0;
The problem is that when I enter the dates in the files (Beginning date and End date) the Number of days field does not calculate. What am I doing wrong?
Your 'if' statement only executes the next line of code not the block of code you want because you have not marked the start and end of the block of code as JavaScript expects.
The picture "MM" is for minutes and 'YY' has no meaning when used with the 'util.scand' method.
George Kaiser