获取三个月后的日期

/**
  * 获取当前,后三个月时间.
  * @return date
  */
 public static Date getLastMonthToDate() {
  Date date = new Date();
  Calendar cal = Calendar.getInstance();
  cal.setTime(date);
  cal.add(Calendar.MONTH, 3);
  return cal.getTime();
 }
 .net

/**
  * 获取当前,后三个月时间.
  * @return string
  */
 public static String getLastMonthToStr() {
  Date date = new Date();
  Calendar cal = Calendar.getInstance();
  cal.setTime(date);
  cal.add(Calendar.MONTH, 3);
  Date otherDate=cal.getTime();
  SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  return dateFormat.format(otherDate);orm

 }get

相关文章
相关标签/搜索