Hello,
I need to show the result of a field (date) plus 30 days.
I tried to use the function getTime(), setDate() , but these are not available.
How can do that?
Thank you.
Hello,
I need to show the result of a field (date) plus 30 days.
I tried to use the function getTime(), setDate() , but these are not available.
How can do that?
Thank you.
Found this on the web. Please try it and let us know!!
function addDays(date, days) {
var result = new Date(date);
result.setDate(result.getDate() + days); return result;
}
BTW, I just tried it and it work wonderfully…of course now it is up to you to format it the way you want.
Hi Claudio,
I’m assuming you want to add 30 days to the current day of the month. If so I added a extract step field in the steps pane and set its mode to javascript. Changed its type to Integer and added the following code to the javascript editor.
var date = new Date();
var daysToAdd = 30;date.setDate(date.getDate() + daysToAdd);
var day = date.getDate();
record.fields.DayPlus30 = day;
This will add whatever days you want to the current day when changing the value of daysToAdd.
Regards,
S
Thank you Hamelj, I will try it.
Test you it in Design or Datamapper?
Thank you S, I will format it to increment other fields, I will change the function and send to you the result.
Claudio