I dont know if this is still outstanding since the original post seems to
have disappeared, but this is what I did during my proof of concept that I
am going through:
In a helper class (i.e. DateHelper) I had this method:
public static Date getModifiedDate(int amount, String unit) {
Calendar cal = Calendar.getInstance();
cal.setTime(getNow());
BusinessObject.stripTime(cal);
int calUnit = Calendar.DAY_OF_YEAR;
if (UNIT_MONTHS.equals(unit))
calUnit = Calendar.MONTH;
else if (UNIT_YEARS.equals(unit))
calUnit = Calendar.YEAR;
cal.add(calUnit, amount);
return cal.getTime();
}
Then in my rule it would be like this:
MyFact( eval( value.before(DateHelper.getModifiedDate(-6, "MONTHS"))))
Hope that helps.
-----
Drools Noob since 5/2008
--
View this message in context: http://www.nabble.com/Re%3A-Date-arithmetic-in--%C3%A2%C2%80%C2%9Cwhen%C3%A2%C2%80%C2%9D-session-tp17103754p17106177.html
Sent from the drools - user mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users