| | |
| | | nowDate = sdfShort.format(date); |
| | | return nowDate; |
| | | } catch (Exception e) { |
| | | throw e; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 2个日期之间相差分钟数 |
| | | * @param begin |
| | | * @param end |
| | | * @return |
| | | */ |
| | | public static Integer betweenMin(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; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算耗时 |
| | | * @param start |
| | |
| | | return consuming.toString(); |
| | | } |
| | | |
| | | } |
| | | } |