|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public static Date getDateFromString2(String strDate) { | 
|---|
|  |  |  | if (StringUtils.isEmpty(strDate)) { | 
|---|
|  |  |  | return new Date(System.currentTimeMillis()); | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return sdfLongTimePlus.parse(strDate); | 
|---|
|  |  |  | 
|---|
|  |  |  | return (int)diff + 1 ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static Integer between(Date begin, Date end) { | 
|---|
|  |  |  | if(begin ==null ){ | 
|---|
|  |  |  | return  0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | long createTime =begin.getTime();//获取创建时间的时间戳 | 
|---|
|  |  |  | long currentTime =Objects.isNull(end)?System.currentTimeMillis():end.getTime();//获取当前时间的时间戳 | 
|---|
|  |  |  | long diff=(currentTime-createTime)/1000/60;//获取两个时间相差的分钟 | 
|---|
|  |  |  | return (int)diff; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static Integer betweenSeconds(Date begin, Date end) { | 
|---|
|  |  |  | if(begin ==null ){ | 
|---|
|  |  |  | return  0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | long createTime =begin.getTime();//获取创建时间的时间戳 | 
|---|
|  |  |  | long currentTime =Objects.isNull(end)?System.currentTimeMillis():end.getTime();//获取当前时间的时间戳 | 
|---|
|  |  |  | long diff=(currentTime-createTime)/1000;//获取两个时间相差的分钟 | 
|---|
|  |  |  | return (int)diff; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 计算耗时 | 
|---|