1 import java.text.SimpleDateFormat;
 2 import java.util.Calendar;
 3 import java.util.Date;
 4 
 5 try {  
 6             //获取当前日期  
 7             Date date = new Date();  
 8             SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");  
 9             String nowDate = sf.format(date);   
10             //通过日历获取下一天日期  
11             Calendar cal = Calendar.getInstance();  
12             cal.setTime(sf.parse(nowDate)); 
13             //获取甲方签字时间 
14             cal.add(Calendar.DAY_OF_YEAR, -2); 
15             String buyerConfirmDate = sf.format(cal.getTime());  
16             //获取乙方签字时间 
17             cal.add(Calendar.DAY_OF_YEAR, +1);
18             String sellerConfirmDate = sf.format(cal.getTime());
19             //获取合同有效期开始时间
20             cal.add(Calendar.DAY_OF_YEAR, +2);
21             String contractValidDate = sf.format(cal.getTime());
22             //获取合同有效期结束时间
23             cal.add(Calendar.DAY_OF_YEAR, +365);
24             String contractStopDate = sf.format(cal.getTime());
25             vars.put("realReceiveDate",contractValidDate);
26         } catch (Exception e) {  
27             // TODO: handle exception  
28         }