| | |
| | | } |
| | | return age; |
| | | } |
| | | |
| | | /** |
| | | * 获取某天结束秒数 |
| | | * @param startTime |
| | | * @return |
| | | */ |
| | | public long todayEndSecond(Date startTime) { |
| | | if(startTime == null){ |
| | | startTime = new Date(); |
| | | } |
| | | Date endTime = DateUtil.dayToEndDate(startTime); |
| | | //多加10秒 |
| | | return differSecond(startTime, endTime) + 10L; |
| | | } |
| | | |
| | | /** |
| | | * 计算2个实际相差秒数 |
| | | * @param startTime 开始时间 |
| | | * @param endTime 结束时间 |
| | | * @return |
| | | */ |
| | | public long differSecond(Date startTime, Date endTime) { |
| | | if(startTime == null || endTime == null){ |
| | | return 0L; |
| | | } |
| | | long sTime = startTime.getTime(); |
| | | long eTime = endTime.getTime(); |
| | | return (eTime - sTime) / 1000L; |
| | | } |
| | | } |