订单详情等相关,手动还车结束订单
This commit is contained in:
@ -9,6 +9,8 @@ import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
/**
|
||||
@ -185,4 +187,25 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个Date之间的天数差
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 相差的天数(如果endDate在startDate之后,返回正数;否则返回负数)
|
||||
*/
|
||||
public static long daysBetween(Date startDate, Date endDate) {
|
||||
long diffInMillis = endDate.getTime() - startDate.getTime();
|
||||
return TimeUnit.DAYS.convert(diffInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个Date之间的天数差(绝对值)
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 相差的天数(总是返回正数)
|
||||
*/
|
||||
public static long daysBetweenAbs(Date startDate, Date endDate) {
|
||||
return Math.abs(daysBetween(startDate, endDate));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user