喻健
2018-12-25 95654e5a5a1d0c4384cf44a1510c670ec804abc7
utils/src/main/java/org/yeshi/utils/DateUtil.java
@@ -5,7 +5,6 @@
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
   
   public static String dateDiff(String startTime, String endTime) {
@@ -34,7 +33,6 @@
      return datatime;
   }
   
   public static String dateDiff2(Date startTime, Date endTime) throws Exception{
      
      String datatime = 0 + "天" + 0 + "小时" + 0 + "分钟" ;
@@ -50,9 +48,7 @@
      long hour = diff % nd / nh;// 计算差多少小时
      long min = diff % nd % nh / nm;// 计算差多少分钟
      
      datatime = day + "天" + hour + "小时" + min + "分钟" ;
      
      return datatime;
   }
@@ -97,4 +93,24 @@
      }
   }
   /**
    * 指定日期加上天数后的日期
    *
    * @param num
    *            为增加的天数
    * @param nowDate
    *            创建时间
    * @return
    * @throws ParseException
    */
   public static String plusDay(int num, String nowDate) throws ParseException {
      SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
      Date currdate = format.parse(nowDate);
      Calendar ca = Calendar.getInstance();
      ca.setTime(currdate);
      ca.add(Calendar.DATE, num);
      return format.format(ca.getTime());
   }
}