//时间增量
Calendar begin=Calendar.getInstance(); begin.setTime(iesSitePatchDO.getBeginTime()); begins.setTime(Date date); begin.set(begin.get(Calendar.YEAR),begin.get(Calendar.MONTH),begin.get(Calendar.DAY_OF_MONTH), begins.get(Calendar.HOUR_OF_DAY),begins.get(Calendar.MINUTE),begins.get(Calendar.SECOND)); begin.add(Calendar.MINUTE,iesSitePatchDO.getDuration()+iesSitePatchDO.getRest());
//设置特定日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date d = sdf.parse("2014-03-02");
或
Calendar calendar=Calendar.getInstance();
calendar.set(2015, 10, 12); //年月日 也可以具体到时分秒如calendar.set(2015, 10, 12,11,32,52);
Date date=calendar.getTime();//需要注意的是calendar月份是从0开始的
简单记录一下日期的一些方法