| | |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | System.out.println(RandomStringUtils.randomNumeric(3)); |
| | | System.out.println((int)(3.222)); |
| | | |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | |
| | | long createTime =begin.getTime();//获取创建时间的时间戳 |
| | | long currentTime =Objects.isNull(end)?System.currentTimeMillis():end.getTime();//获取当前时间的时间戳 |
| | | long diff=(currentTime-createTime)/1000/60;//获取两个时间相差的分钟 |
| | | 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; |
| | | } |
| | | |