List of utility methods to do Date Parse
Date | getDateFromISO8601(String iso8601Date) get Date From ISO SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_DATE_FORMAT); try { return sdf.parse(iso8601Date); } catch (ParseException e) { e.printStackTrace(); return null; |
Date | getDateFromIsoString(String dateString) Parse ISO 8601 date string into Date object. return getDateFromString(dateString, ISO8601);
|
Date | getDateFromISOString(String iso) get Date From ISO String SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); sdf.setLenient(false); try { if (iso == null) return null; return sdf.parse(iso); } catch (ParseException e) { ... |
String | getDateFromOffset(Date prevDate, int offset) get Date From Offset Date dt = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Calendar c = Calendar.getInstance(); c.setTime(prevDate); c.add(Calendar.DATE, offset); return dateFormat.format(c.getTime()); |
Date | getDateFromOriDateStr(String strDate) get Date From Ori Date Str Date date = null; if (null == strDate || "".equals(strDate)) { return null; } else { SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); try { date = sdf.parse(strDate); } catch (ParseException e1) { ... |
String | getDateFromRange(String date) get Date From Range java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.setTime(getDateFromStr(date));
return formatterDDMMYYYYEx.format(calendar.getTime());
|
Date | getDateFromRequestStringDate(String dateString) get Date From Request String Date Date resDate = null; try { String dateSource = dateString; dateSource = dateSource.trim(); dateSource = dateSource.replaceAll("T", " "); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); resDate = simpleDateFormat.parse(dateSource); } catch (ParseException exc) { ... |
Date | getDateFromRFC822String(Object rfc822) FIX: In order to make EPL nested calls, we need this guy to be able to accept Object which is a string actually return rfc822 == null ? null : new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").parse(rfc822.toString()); |
Date | getDateFromStr(DateFormat format, String s) get Date From Str if (s == null || s.trim().equals("")) { return null; if (format == null) { if (s.length() == 10) { format = format_yyyyMMdd; } else if (s.length() == 16) { format = format13; ... |
Date | getDateFromStr(String date) get Date From Str Date result = null; try { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); sdf.setLenient(false); result = sdf.parse(date); } catch (Exception e) { System.out.println("Error: " + e.toString()); return result; |