模仿银行系统的日切

最近在学习Java基础,由于没有从事过银行工作,所以就自己模仿一个日切

public class TestDate {

    
    /**
     * 日切方法
     * @throws ParseException 
     */
     public void testDateSwitch(Date date){
         SimpleDateFormat sdm = new SimpleDateFormat("yyyyMMdd");
         String str =  sdm.format(date);
           System.out.println("  原系统日期是-------"+str);
          Calendar ca = Calendar.getInstance();
         ca.setTime(date);
         ca.add(Calendar.DAY_OF_YEAR, 1);
         Date str2 = ca.getTime();
         str =  sdm.format(str2);
           System.out.println("  日切后系统是-------"+str);     
     }
     
     @Test
     public void test(){
         Date date =new Date();
         testDateSwitch(date);
     }
}

 

posted @ 2012-12-19 22:41  段段1006  阅读(698)  评论(0)    收藏  举报