@Test public void testFormat() { int count = 2; int j = 2; while (j > 0) { Thread[] threads = new Thread[count]; for (int i = 0; i < count; i++) { Thread thread = new Thread(() -> { String date = DateUtil.format(DateUtil.YYYY_MM_DD_HH_MM_SS, new Date()); assertNotNull(date); date = DateUtil.format(DateUtil.YYYY_MM_DD, new Date()); assertNotNull(date); }); threads[i] = thread; } for (int i = 0; i < count; i++) { threads[i].start(); } j--; } }
public static String format(String format, Date date) { return date != null ? getDateFormat(format).format(date) : null; }
DateUtil { public static String format(String format, Date date) { return date != null ? getDateFormat(format).format(date) : null; } }
DateUtil { public static String format(String format, Date date) { return date != null ? getDateFormat(format).format(date) : null; }  }
DateUtil { public static String format(String format, Date date) { return date != null ? getDateFormat(format).format(date) : null; }  static DateFormat getDateFormat(String format); static String format(String format, Date date); static Date parse(String format, String date); static String getDateStr(Date date, String format, int i, int j); static boolean isLeapYear(int year); static int maxDayOfMonth(int year, int month); static int year(Date date); static int month(Date date); static int day(Date date); static int getTimeNumber(Date date, int i); static int week(Date date); static int getQuarter(Date date); static int dayOfQuarter(Date date); static int days(Date date); static int dayOfYear(Date date); static String dateRedMonthBegin(Date date, int n); static String dateRedMonthEnd(Date date, int n); static Date getDateByCalendar(Date date, int i, int j); static long getBetweenDiff(Date startDate, Date endDate, long time); static boolean isDBDefaultDate(Date date); }
DateUtil { public static String format(String format, Date date) { return date != null ? getDateFormat(format).format(date) : null; }  static DateFormat getDateFormat(String format); static String format(String format, Date date); static Date parse(String format, String date); static String getDateStr(Date date, String format, int i, int j); static boolean isLeapYear(int year); static int maxDayOfMonth(int year, int month); static int year(Date date); static int month(Date date); static int day(Date date); static int getTimeNumber(Date date, int i); static int week(Date date); static int getQuarter(Date date); static int dayOfQuarter(Date date); static int days(Date date); static int dayOfYear(Date date); static String dateRedMonthBegin(Date date, int n); static String dateRedMonthEnd(Date date, int n); static Date getDateByCalendar(Date date, int i, int j); static long getBetweenDiff(Date startDate, Date endDate, long time); static boolean isDBDefaultDate(Date date); static final String YYYYMMDD; static final String YYYY_MM_DD; static final String DDMMYY; static final String YYYY_MM; static final String YYYY_MM_DD_HH_MM_SS; static final String YYMMDDHHMMSS; static final String YYYYMMDDHH; static final String YYYYMMDDHHMMSS; static final String HH_MM_SS; static final String HHMMSS; static final String HH_MM; static final long SECOND_TIME; static final long MINUTE_TIME; static final long HOUR_TIME; static final long DAY_TIME; }