|  |  | 
 |  |  |     // StringUtil.getNotNullStr(request.getParameter(strParamName)); | 
 |  |  |     // return getDateByString(strStr); | 
 |  |  |     // } | 
 |  |  |     /** | 
 |  |  |      * 得到当前日期,格式yyyy-MM-dd。 | 
 |  |  |      * | 
 |  |  |      * @return String 格式化的日期字符串 | 
 |  |  |      */ | 
 |  |  |     public static String getCurrDate() { | 
 |  |  |         return getFormattedDate(getDateByString("")); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 得到当前日期,格式yyyy-MM-dd。 | 
 |  |  | 
 |  |  |     public static String getCurrDateTime() { | 
 |  |  |         Timestamp date = new Timestamp(System.currentTimeMillis()); | 
 |  |  |         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | 
 |  |  |         return formatter.format(date); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 得到当前日期时间,格式为yyyy-MM-dd. | 
 |  |  |      * | 
 |  |  |      * @return String | 
 |  |  |      */ | 
 |  |  |     public static String getCurrDate() { | 
 |  |  |         Timestamp date = new Timestamp(System.currentTimeMillis()); | 
 |  |  |         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | 
 |  |  |         return formatter.format(date); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         return DateToStr(date, "yyyyMMdd"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static String afterDateHourToStr(Integer hour){ | 
 |  |  |         Date date = new Date(); | 
 |  |  |         Long l = date.getTime()+1000*60*60*hour; | 
 |  |  |         date.setTime(l); | 
 |  |  |         return DateToStr(date, "yyyyMMdd"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public static String beforeDateToStr(Integer days){ | 
 |  |  |         Date date = new Date(); | 
 |  |  |         Long l = date.getTime()-1000*60*60*24*days; | 
 |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取X天后的日期 | 
 |  |  |      * @param date | 
 |  |  |      * @param beforDays 明天 -1  昨天 1 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public static String getBeforDay(Date date,Integer beforDays){ | 
 |  |  |         ZonedDateTime zonedDateTime = date.toInstant().atZone(ZoneId.systemDefault()); | 
 |  |  |         // 转换为java.time.LocalDate,计算x天的日期 | 
 |  |  |         LocalDate dateBeforeDay = zonedDateTime.toLocalDate().minusDays(beforDays); | 
 |  |  |         return dateBeforeDay.toString(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |