燕山石化溯源三维电子沙盘-【后端】-服务
5
13693261870
2023-07-29 25169ce9015c91b1596619fcc27b5554bd73bee7
src/main/java/com/yssh/utils/DateUtils.java
@@ -249,9 +249,10 @@
    *
    * @return String
    **/
   public static Date getMonthStart() {
   public static Date getMonthStart(Date date) {
      Calendar cal = Calendar.getInstance();
      //cal.set(Calendar.MONTH, 3);
      // cal.set(Calendar.MONTH, 3)
      cal.setTime(date);
      cal.set(Calendar.DAY_OF_MONTH, 1);
      return dateTime(YYYY_MM_DD_HH_MM_SS, parseDateToStr(YYYY_MM_DD, cal.getTime()) + " 00:00:00");
   }
@@ -261,16 +262,11 @@
    *
    * @return String
    **/
   public static Date getMonthEnd() {
   public static Date getMonthEnd(Date date) {
      Calendar cal = Calendar.getInstance();
      //cal.set(Calendar.MONTH, 3);
      // cal.set(Calendar.MONTH, 3)
      cal.setTime(date);
      cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
      return dateTime(YYYY_MM_DD_HH_MM_SS, parseDateToStr(YYYY_MM_DD, cal.getTime()) + " 23:59:59");
   }
   public static void main(String[] args) {
      //System.out.println(parseDateToStr(YYYY_MM_DD_HH_MM_SS, getMonthStart()));
      //System.err.println(parseDateToStr(YYYY_MM_DD_HH_MM_SS, getMonthEnd()));
      System.out.println(parseDateToStr(YYYY_MM_DD_HH_MM_SS, getAPeriodOfTime(getNowDate(), -7, Calendar.DATE)));
   }
}