I'm a complete novice at form calculations. I have successfully gotten some fields to subtract and multiply; however, I cannot get two fields to configure the number of days between two dates. For instance, from July 1, 2010 to September 1, 2010, there are 62 days. I then need this number to calculate the percentage of time for the year.
Any help is welcomed and appreciated!
*Using LiveCycle Designer 8.0
Views
Replies
Total Likes
in a script object (I'll name Helper):
function calculateDateDifference(dateOne, dateTwo){
var dOne = new Date(dateOne);
var dTwo = new Date(dateTwo);
var oneDay = 1000*60*60*24; //milliseconds in a day
return Math.ceil((dTwo - dOne) / oneDay);
}
then you would just do:
var percentage = (Helper.calculateDateDifference("July 1, 2010", "September 1, 2010") / 365) * 100;
That should work...hope it helps
Aye. I know this should be the answer, but I can't get it to work.
I put the script in, and remaned the fields, and no go.
Views
Replies
Total Likes
Had to learn a little on my own, but eventually got it! Had to brush off my Java skills from 10 years ago (eeekkk!). Thanks for the help!
Views
Replies
Total Likes