| | |
| | | } |
| | | |
| | | /** |
| | | * 获取两个时间的间隔(秒)Obtain the time difference between two instances (in seconds). |
| | | * 获取两个时间的间隔(秒)Obtain the time difference between two instances (in seconds). |
| | | * |
| | | * @param startDate 开始的时间 |
| | | * @return 返回当前时间与开始时间的相差天数 |
| | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | long startDateTime = dateFormat.parse(dateFormat.format(startDate)).getTime(); |
| | | long endDateTime = dateFormat.parse(dateFormat.format(endDate)).getTime(); |
| | | int days = (int)((endDateTime - startDateTime) / (1000 * 3600 * 24)); |
| | | int days = (int) ((endDateTime - startDateTime) / (1000 * 3600 * 24)); |
| | | return days; |
| | | } |
| | | |