List of utility methods to do Date Parse
String | asDate(Date date, String format) Formats a Date based on the provided format. return asDate(date, format, "Unknown"); |
String | asDate(final long time) as Date if (time > 0) { return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(time)); } else { return "-"; |
Date | asDate(final Map as Date final Object value = map.get(key); if (value == null) { return null; if (value instanceof String) { try { return dateFormat().parse((String) value); } catch (ParseException ex) { ... |
Calendar | asDate(final String literal) Method formats the given literal as date literal. Date date = null; for (String pattern : datePatterns) { try { date = new SimpleDateFormat(pattern).parse(literal); } catch (ParseException e) { if (date == null) { ... |
Date | asDate(String date) as Date try { return DATE_FORMAT.parse(date); } catch (Exception e) { return null; |
Date | asDate(String param, SimpleDateFormat format) as Date if (param == null) { return null; if (param instanceof String) { try { return format.parse(param); } catch (ParseException e) { throw new IllegalArgumentException( ... |
Date | asDate(String s) as Date if ("\"N/A\"".equals(s)) return null; return FMT_TRADE_DATE.get().parse(s); |
Date | asDate(String string) asDate. try { if (isIsoFormat(string)) { throw new RuntimeException("Date does not fit into ISO date format."); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = simpleDateFormat.parse(string); return date; } catch (ParseException parseException) { ... |
Date | asDate(String value, String format) as Date SimpleDateFormat df = new SimpleDateFormat(format); df.setLenient(false); try { ParsePosition pp = new ParsePosition(0); Date d = df.parse(value, pp); if (pp.getIndex() != value.length()) { d = null; return d; } catch (Exception e) { return null; |
String | convertDateForExcel(String timestamp) Converts the time from FLAME format to Excel-friendly format SimpleDateFormat date_format = new SimpleDateFormat(flameDateFormat); SimpleDateFormat excel_format = new SimpleDateFormat(excelDateFormat); Calendar c = Calendar.getInstance(); c.setTime(date_format.parse(timestamp)); return excel_format.format(c.getTime()); |