| | |
| | | * @return String |
| | | * @throws Exception |
| | | */ |
| | | public static String getNowMonth() throws Exception { |
| | | public static Integer getNowMonth() throws Exception { |
| | | String nowMonth = ""; |
| | | try { |
| | | String strTemp = getNowLongTime(); |
| | | nowMonth = strTemp.substring(4, 6); |
| | | return nowMonth; |
| | | return Integer.valueOf(nowMonth); |
| | | } catch (Exception e) { |
| | | throw e; |
| | | } |
| | |
| | | // System.out.println(DateUtil.afterMinutesDate(-5)); |
| | | |
| | | |
| | | System.out.println(getPlusTime2(DateUtil.addMonthToDate(new Date(),-1))); |
| | | // System.out.println(DateUtil.getBeforMonthStr(new Date(),12)); |
| | | // List<String> s = DateUtil.getDayByMonth(); |
| | | // System.out.println(getPlusTime2(DateUtil.addMonthToDate(new Date(),-1))); |
| | | System.out.println(DateUtil.getNowMonth()); |
| | | |
| | | // List<Date> list =getThisMonthDateList(); |
| | | // for(Date d :list){ |
| | |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | public static Date afterHoursDate(Date date,Integer hours){ |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | cal.add(Calendar.HOUR,hours); |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * LocalDateTime to date |
| | | * @param now |