posts - 27,comments - 2,trackbacks - 0
 
      
      /**
* 得到几天前的时间
* @param d
* @param day
* @return
*/
public static Date getDateOfBefore(Date d, int day) {
Calendar now = Calendar.getInstance();
now.setTime(d);
now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
return now.getTime();
}
      /**
* 得到几天后的时间
* @param d
* @param day
* @return
*/
public static Date getDateOfAfter(Date d, int day) {
Calendar now = Calendar.getInstance();
now.setTime(d);
now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
return now.getTime();
}
posted on 2013-06-28 17:55 魏文甫 阅读(269) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: