读书人

calender 种

发布时间: 2012-11-09 10:18:48 作者: rapoo

calender 类

 public   static   String   addDate(String   day,int   x)         {             SimpleDateFormat   format=new   SimpleDateFormat("yyyy/MM/dd");             Date   date   =   null;             try             {                 date   =   format.parse(day);             }             catch   (ParseException   ex)             {                 ex.printStackTrace();             }             if   (date==null)   return   "";             Calendar   cal=Calendar.getInstance();             cal.setTime(date);             cal.add(Calendar.DAY_OF_MONTH,5);//当前日历加5天          calender.add(Calendar.AM_PM, 5);  //当前日历加5*12小时           date=cal.getTime();             System.out.println("3   days   after(or   before)   is   "+format.format(date));             cal=null;             return   format.format(date);         }

读书人网 >软件架构设计

热点推荐