public static Date parse(String date) { try { for (Map.Entry<Pattern, String> entry : regPatternMap.entrySet()) { boolean isMatch = entry.getKey().matcher(date).matches(); if (isMatch) { return FastDateFormat.getInstance(entry.getValue()).parse(date); } } } catch (ParseException e) { throw new IllegalArgumentException("can't support this pattern , date is " + date); } throw new IllegalArgumentException("can't support this pattern , date is " + date); }
public static Date parseYMD(String date) { try { return FastDateFormat.getInstance(YMD).parse(date); } catch (ParseException e) { e.printStackTrace(); } return null; }
/** * 方法描述:格式化日期 */ public static String formatDate(Date d, String fmt) { return FastDateFormat.getInstance(fmt).format(d); }
public static Date parseYMD(String date) { try { return FastDateFormat.getInstance(YMD).parse(date); } catch (ParseException e) { e.printStackTrace(); } return null; }
public static Date parseYMD_HMS(String date) { try { return FastDateFormat.getInstance(YMD_HMS).parse(date); } catch (ParseException e) { throw new IllegalArgumentException("the date pattern is error!"); } }
/** * 方法描述:格式化日期 */ public static String formatDate(Date d, String fmt) { return FastDateFormat.getInstance(fmt).format(d); }
public static Date parse(String date, String fmt) { try { return FastDateFormat.getInstance(fmt).parse(date); } catch (Exception e) { e.printStackTrace(); } return null; }
public static Date parseYMD_HMS(String date) { try { return FastDateFormat.getInstance(YMD_HMS).parse(date); } catch (ParseException e) { throw new IllegalArgumentException("the date pattern is error!"); } }
public static Date parse(String date, String fmt) { try { return FastDateFormat.getInstance(fmt).parse(date); } catch (Exception e) { e.printStackTrace(); } return null; }
public static String formatYMD(Date d) { return FastDateFormat.getInstance(YMD).format(d); }
public static String formatDate(Long date, String fmt) { return FastDateFormat.getInstance(fmt).format(date); }
public static Date parse(String date) { try { for (Map.Entry<Pattern, String> entry : regPatternMap.entrySet()) { boolean isMatch = entry.getKey().matcher(date).matches(); if (isMatch) { return FastDateFormat.getInstance(entry.getValue()).parse(date); } } } catch (ParseException e) { throw new IllegalArgumentException("can't support this pattern , date is " + date); } throw new IllegalArgumentException("can't support this pattern , date is " + date); }
public static String formatDate(Long date, String fmt) { return FastDateFormat.getInstance(fmt).format(date); }
public static String format(Date date, String fmt) { return FastDateFormat.getInstance(fmt).format(date); }
public static String formatYMD(Date d) { return FastDateFormat.getInstance(YMD).format(d); }
public static String formatYMD_HMS(Date d) { return FastDateFormat.getInstance(YMD_HMS).format(d); }
public static String formatYMD_HMS(Date d) { return FastDateFormat.getInstance(YMD_HMS).format(d); }
public static String format(Date date, String fmt) { return FastDateFormat.getInstance(fmt).format(date); }
/** * 是否是同一天 */ public static boolean isSameDay(Date date, Date date2) { if (date == null || date2 == null) { return false; } FastDateFormat df = FastDateFormat.getInstance(YMD); return df.format(date).equals(df.format(date2)); }
/** * 是否是同一天 */ public static boolean isSameDay(Date date, Date date2) { if (date == null || date2 == null) { return false; } FastDateFormat df = FastDateFormat.getInstance(YMD); return df.format(date).equals(df.format(date2)); }