`
haohao-xuexi02
  • 浏览: 208762 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

小例子--当前时间加三天时间减一秒

    博客分类:
  • java
 
阅读更多

public static void main(String[] args) {
   SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     Date currentDate = new Date(System.currentTimeMillis()); 
     Calendar calender = Calendar.getInstance();
    calender.setTime(currentDate);
    System.out.println("当天时间:"+currentDate.toLocaleString());
     calender.add(Calendar.DATE, 3);
     calender.add(Calendar.SECOND, -1);
     Date dueTime=null;
     try {
      dueTime = simpleDateFormat.parse(simpleDateFormat.format(calender.getTime()).toString());
         } catch (ParseException e) {
  
      e.printStackTrace();
      }
    System.out.println("input into endDate:"+dueTime.toLocaleString());
     
   
 
 }

分享到:
评论
2 楼 haohao-xuexi02 2011-06-01  
xiang37 写道
是这个啊 !

你以为呢?其实很简单。
1 楼 xiang37 2011-06-01  
是这个啊 !

相关推荐

Global site tag (gtag.js) - Google Analytics