| | |
| | | public static final String DATE_FORMATE_STRING_M = "yyyyMM"; |
| | | public static final String DATE_FORMATE_STRING_N = "HHmmss"; |
| | | public static final String DATE_FORMATE_STRING_O = "yyyyMMddHHmm"; |
| | | public static final String DATE_FORMATE_STRING_Q = "yyyy-MM"; |
| | | |
| | | |
| | | |
| | | static { |
| | |
| | | formats.put("yyyyMM", new SimpleDateFormat("yyyyMM")); |
| | | formats.put("HHmmss", new SimpleDateFormat("HHmmss")); |
| | | formats.put("yyyyMMddHHmm", new SimpleDateFormat("yyyyMMddHHmm")); |
| | | formats.put("yyyy-MM", new SimpleDateFormat("yyyy-MM")); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * @return:list |
| | | */ |
| | | public static List<String> getMonthBetweenDate(String startTime, String endTime) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMATE_STRING_M); |
| | | SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMATE_STRING_Q); |
| | | // 声明保存日期集合 |
| | | List<String> list = new ArrayList<>(); |
| | | try { |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 除去 小时 分 秒 |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static Date timeToDate(Date time){ |
| | | Calendar calendar =Calendar.getInstance(); |
| | | calendar.setTime(time); |
| | | setTimeToMidnight(calendar); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | } |