code: public static String smartFormat(Date date) {
          String dateStr = null;
          if (date == null) {
              dateStr = "";
          } else {
              try {
                  dateStr = formatDate(date, Y_M_D_HMS);
                  //时分秒
                  if (dateStr.endsWith(" 00:00:00")) {
                      dateStr = dateStr.substring(0, 10);
                  }
                  //时分
                  else if (dateStr.endsWith("00:00")) {
                      dateStr = dateStr.substring(0, 16);
                  }
                  //秒
                  else if (dateStr.endsWith(":00")) {
                      dateStr = dateStr.substring(0, 16);
                  }
              } catch (Exception ex) {
                  throw new IllegalArgumentException("转换日期失败: " + ex.getMessage(), ex);
              }
          }
          return dateStr;
      }
docs: 智能转换日期
  
  @param date
  @return