List of utility methods to do Parse Date
Date | parseDate(String value) parse Date if (value == null || value.length() == 0) { return null; } else if (value.length() == 4) { return getSimpleDateFormat(HL7TSFormat4).parse(value); } else if (value.length() == 8) { return getSimpleDateFormat(HL7TSFormatL8).parse(value); } else if (value.length() == 12) { return getSimpleDateFormat(HL7TSFormatL12).parse(value); ... |
Date | parseDate(String value) Parse a date expression with both date and time information with full millisecond precision and create a Date . try { return createDateFormat().parse(value); } catch (ParseException e) { throw new IllegalArgumentException("Failed to parse date expression '" + value + "'", e); |
Date | parseDate(String value) parse Date Date date = null; try { date = HEADER_DATE.parse(value); } catch (Exception e) { return date; |
Date | parseDate(String value) Loops over all the possible date formats and tries to find the right one. if (value == null) { return null; Date date = null; for (ThreadLocal<SimpleDateFormat> format : DATETIME_FORMATS) { try { date = format.get().parse(value); break; ... |
Date | parseDate(String value) parse Date Date[] dates = parseDate(new String[] { value }); if (dates != null && dates.length > 0) return dates[0]; return null; |
Date | parseDate(String value) Attempts to parse a date in various formats. for (int i = 0; i < DATE_FORMATS.length; i++) { SimpleDateFormat df = new SimpleDateFormat(DATE_FORMATS[i]); try { return df.parse(value); } catch (ParseException e) { return null; ... |
Date | parseDate(String value, Class targetType, String... formats) parse Date for (String format : formats) { try { long v = new SimpleDateFormat(format).parse(value).getTime(); return (Date) targetType.getConstructor(long.class).newInstance(v); } catch (ParseException e) { } catch (Exception e) { throw new RuntimeException(e); try { return (Date) targetType.getConstructor(String.class).newInstance(value); } catch (Exception e) { throw new IllegalArgumentException( "cannot parse:" + value + " for date by formats:" + Arrays.asList(formats)); |
Date | parseDate(String value, String formater) parse Date Date date = null; sdf.applyPattern(formater); try { date = sdf.parse(value); } catch (ParseException e) { e.printStackTrace(); return date; ... |
java.util.Date | parseDate(String value, String pattern) parse Date try { TimeZone tz = TimeZone.getDefault(); String dateFormat = pattern; SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); sdf.setTimeZone(tz); java.util.Date parsed = null; parsed = sdf.parse(value); return parsed; ... |
String | parseDate2String(Date date) parse Date String return parseDate2String(date, null);
|