Future Date Calculation
I need to add 60 days to a date and then roll it forward to the next first of the month. Date format is mm/dd/yyyy. Original date field is "Hire Date".
I need to add 60 days to a date and then roll it forward to the next first of the month. Date format is mm/dd/yyyy. Original date field is "Hire Date".
Have you done any programming?
There have been many similar questions about computing future dates. Have you searched for these items?
First one needs to convert the date character string to the JavaScript date object. Next add 60 days to the date object. Set to the 1st of the month. Finally add 1 month the month of the date object and format the result for display.
One possible custom calculation script for the anniversary date is:
// get the hire date string;
var cHireDate = this.getField("Hire Date").value;
// convert date string to date object;
var oDate = util.scand("mm/dd/yyy", cHireDate);
// add 60 days;
oDate.setDate(oDate.getDate() + 60);
// set date oject to first of the month;
oDate.setDate(1);
// add one month;
oDate.setMonth(oDate.getMonth() + 1);
// format the result;
event.value = util.printd("mm/dd/yyyyy", oDate);
Note the anniversary date field's format is "None".
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.