AnsweredAssumed Answered

Add 14 days to date - Groovy Function

Question asked by TomDevonald1411 on May 10, 2017
Latest reply on Jul 5, 2018 by ranjini610499



I am trying to add 14 days to an input date based on another input but I am getting the error below.


Error executing custom script: No signature of method: java.util.GregorianCalendar.add() is applicable for argument types: (java.util.Date, java.lang.Integer) values: {Sat Apr 29 00:00:00 UTC 2017, 14} (in groovy script);


I have 2 inputs to my groovy script; DC_DATE and STATUS_05. If the status_05 != 'DTS' then the output (ZZINIT_DUE_DATE) is the DC_DATE (I believe this part is working) but if the status_05 is equal to 'DTS' then I want to add 14 days to the input date. I got the below script from another Boomi forum but I can't get it to work. Does anyone know what I am doing wrong? My script is below.


import java.util.GregorianCalendar;

import java.util.Calendar;

import java.util.Date;


if (STATUS_05 != "DTS") {


} else {


Calendar calendar = new GregorianCalendar();

calendar.setTime(new Date());

calendar.add(DC_DATE, 14);


ZZINIT_DUE_DATE = calendar.getTime();




As a note, my input DC_DATE is a date (yyyy-MM-dd) and my output/destination ZZINIT_DUE_DATE is a character entry.


Thanks in advance!