| | |
| | | } |
| | | |
| | | |
| | | |
| | | public static String getLastTime() { |
| | | return LAST_TIME; |
| | | } |
| | |
| | | private static int millisecondsToDays(long intervalMs) { |
| | | return (int) (intervalMs / (1000 * 86400)); |
| | | } |
| | | |
| | | /** |
| | | * *字符串的日期格式的计算 |
| | | * |
| | | */ |
| | | public static int daysBetween(String smdate, String bdate) { |
| | | long between_days = 0; |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(sdf.parse(smdate)); |
| | | long time1 = cal.getTimeInMillis(); |
| | | cal.setTime(sdf.parse(bdate)); |
| | | long time2 = cal.getTimeInMillis(); |
| | | between_days = (time2 - time1) / (1000 * 3600 * 24); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return Integer.parseInt(String.valueOf(between_days)); |
| | | } |
| | | } |