select   to_number(to_date('2018-09-09','yyyy-mm-dd') -to_date('2018-09-01', 'yyyy-mm-dd') )    as dataNum from  dual
Date dBefore = new Date();
Calendar calendar = Calendar.getInstance(); //得到日历
calendar.setTime(ExpecteddrugDa);//把预计进药时间赋给日历
calendar.add(calendar.MONTH, -2); //设置为前2月
dBefore = calendar.getTime(); //得到前2月的时间
String beforeTwoMonDate = sdf.format(dBefore); //格式化前2月的时间 预计日期-2个月