/** * convert the String to a DateTime field using the defined formatters */ public static DateTime parseDateTime(String timeStr) { for (DateTimeFormatter formatter : DATE_TIME_FORMATTERS) { try { return formatter.parseDateTime(timeStr); } catch (IllegalArgumentException e) { } } throw new IllegalArgumentException("Date/time cannot be parsed - acceptable examples: " + getDateTimeExamples()); }
public Builder before(String before) { if (before != null) { try { this.before = Formatters.parseDateTime(before); } catch (IllegalArgumentException e) { } } return this; }
public Builder modifiedAfter(String after) { if (after != null) { try { this.modifiedAfter = Formatters.parseDateTime(after); } catch (IllegalArgumentException e) { } } return this; }
public Builder after(String after) { if (after != null) { try { this.after = Formatters.parseDateTime(after); } catch (IllegalArgumentException e) { } } return this; }
/** * convert the String to a DateTime field using the defined formatters */ public static DateTime parseDateTime(String timeStr) { for (DateTimeFormatter formatter : DATE_TIME_FORMATTERS) { try { return formatter.parseDateTime(timeStr); } catch (IllegalArgumentException e) { } } throw new IllegalArgumentException("Date/time cannot be parsed - acceptable examples: " + getDateTimeExamples()); }
public Builder modifiedBefore(String before) { if (before != null) { try { this.modifiedBefore = Formatters.parseDateTime(before); } catch (IllegalArgumentException e) { } } return this; }
private static Long convertDateTimeStringToMillis(String filterKey, Object value) { Long millis = null; if (CommonFilterTranslations.isDateStoredAsMillisField(filterKey) && value instanceof String) { //attempt to convert the incoming value to a long try { DateTime dateTime = Formatters.parseDateTime((String) value); millis = dateTime.getMillis(); } catch (IllegalArgumentException e) { //uanble to parse the value } } return millis; }