Hi everyone!
I wrote a Java Snippet, that should test if deliverydatereal is equal to 0002-11-30. If that´s the case then it should be changed to deliverydatepromised - 1
If not then the real date should be returned.
I wrote the following code (I changed the code of IRIS from this forum a bit):
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date real = new Date();
Date prom = new Date();
try{
real = format.parse($deliverydatereal$);
prom = format.parse($deliverydatepromised$);
if (real.equals("0002-11-30")) {
//subtract 1 day
prom.setTime(prom.getTime()-1 * 24 * 60 * 60 * 1000); }
else { prom = real; }
}
catch(Exception e){}
return format.format(prom);
The problem is that only the old real dates are returned for all rows. There has to be something wrong with the if statement, but I can´t figure it out.
Thank you in advance
Best regards