import java.text.SimpleDateFormat def checkOutTime = context.expand( '${getLeaseOrderId#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/FUN_LEASE_ORDER.CHECK_OUT_TIME[1]}' ) def checkOutTime1 = context.expand( '${getRentPeriod#Response#$.data.checkoutDate}' ) def tenancy = context.expand( '${getRentPeriod#Request#$.tenancy}' ) def t=tenancy .toInteger() import java.text.SimpleDateFormat; formatter = new SimpleDateFormat( "yyyy-MM") String s = checkOutTime Date date = formatter.parse(s) //log.info(date) use (groovy.time.TimeCategory) { def someDate = date time = someDate + t.months } def b = checkOutTime1.substring(0,7) assert (time.format("yyyy-MM")==b)