List of utility methods to do Parse Date
Date | parseDate(String certDate) parse Date String dateToParse = certDate; DateFormat dateFormat = fullDateFormat; switch (certDate.length()) { case 1: case 2: dateFormat = yearDateFormat; break; case 3: ... |
Date | parseDate(String currDate) parse Date SimpleDateFormat dtFormatdB = null; dtFormatdB = new SimpleDateFormat("yyyy-MM-dd"); try { return dtFormatdB.parse(currDate); } catch (Exception e) { try { return dtFormatdB.parse(currDate); } catch (Exception ex) { ... |
Date | parseDate(String d) parse date produced by DeID software in format **DATE[Oct 15 2007] 1453 . SimpleDateFormat sd1 = new SimpleDateFormat("MMM d yyyy HH:mm"); SimpleDateFormat sd2 = new SimpleDateFormat("MMM d yyyy"); Pattern pt = Pattern.compile("\\*\\*DATE\\[([A-Za-z]+ \\d{1,2} \\d{4})\\](?:\\s(\\d{2})\\:?(\\d{2}))?"); Matcher mt = pt.matcher(d); if (mt.matches()) { String date = mt.group(1); String h = mt.group(2); String m = mt.group(3); ... |
Date | parseDate(String d) parse Date if (d == null) { return null; try { return s_dateFormat.parse(d); } catch (ParseException e) { throw new RuntimeException(e); |
long | parseDate(String d) Parse date like "yyyy-MM-dd". try { return new SimpleDateFormat(DATE_FORMAT).parse(d).getTime(); } catch (Exception e) { return 0; |
Date | parseDate(String datastr, String pattern) parse Date try { DateFormat parser = new SimpleDateFormat(pattern); return parser.parse(datastr); } catch (ParseException ex) { return null; |
Calendar | parseDate(String date) Try parse a Date from a String with 2 different formats, otherwise return null if (date == null || date.equals("null")) { return null; List<SimpleDateFormat> dateFormats = new ArrayList<SimpleDateFormat>(); dateFormats.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); Date d = new Date(); for (SimpleDateFormat format : dateFormats) { try { ... |
Date | parseDate(String date) Parses a date of the form 1969-12-31T21:00:00-03:00, or 2008-02-13T18:54:29.147-03:00. if (date == null) { return null; int index = date.lastIndexOf(":"); date = date.substring(0, index) + date.substring(index + 1); Date d = null; try { if (date.length() == 24) { ... |
Date | parseDate(String date) parse Date try { return new SimpleDateFormat("yyyy-MM-dd").parse(date); } catch (ParseException e) { return null; |
Date | parseDate(String date) parse Date try { return createFormater().parse(date); } catch (ParseException e) { throw new RuntimeException("Unexpected date format " + date); |