List of utility methods to do Parse Date Pattern YYYY
Calendar | parse(String source) Null-safe method to create a Calendar from a formatted String . Calendar cal = Calendar.getInstance();
cal.setTime(df.parse(source));
return cal;
|
Date | parse(String source) parse if (source.equalsIgnoreCase("today")) { return new Date(); if (source.equalsIgnoreCase("yesterday")) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -1); return cal.getTime(); try { return DATE_FORMAT.parse(source); } catch (ParseException e) { return null; |
Date | parse(String source, Date defaultValue) parse try { return parse(source, "yyyy-MM-dd HH:mm:ss"); } catch (Exception e) { return defaultValue; |
Date | parse(String str) parse if (str.length() != DATE_PATTERN.length() && str.length() != DATE_TIME_PATTERN.length()) { return null; String formatPattern = DATE_PATTERN; if (str.length() > 10) { formatPattern = DATE_TIME_PATTERN; try { ... |
Date | parse(String str) parse SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); try { if (str.length() < INIT_DATE_TIME.length()) { str += INIT_DATE_TIME.substring(str.length() + 1); return sdf.parse(str); } catch (ParseException e) { return null; ... |
Date | parse(String str) parse DateFormat fmt = new SimpleDateFormat(DATE_FORMAT); try { return fmt.parse(str); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date format", e); |
long | parse(String str) parse int len = str.length(); String date = str.substring(0, 10); Long baseline = map.get(date); if (baseline == null) { try { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); format.setTimeZone(TimeZone.getTimeZone("GMT+8")); baseline = format.parse(date).getTime(); ... |
Date | parse(String str) parse return getISO8601DateFormat().parse(str);
|
Date | parse(String strDate) parse return parse(strDate, getDatePattern());
|
Date | parse(String strDate) parse if (null == strDate || "".equals(strDate)) { return null; try { return parseISO8601(strDate); } catch (ParseException exp) { return parseRFC2616(strDate); |