List of utility methods to do Parse Date
Date | parseDate(final String date, final String format) Parse string to date using given format. final SimpleDateFormat dfmt = new SimpleDateFormat(format); return dfmt.parse(date); |
Date | parseDate(final String dateStr) Attempts to parse given date string using patterns described https://tools.ietf.org/html/rfc6991#page-11 with exception that ONLY UTC patterns are accepted. for (final String fmt : DATE_AND_TIME_FORMATS) { try { final SimpleDateFormat sdf = new SimpleDateFormat(fmt); sdf.setTimeZone(TZ_UTC); return sdf.parse(dateStr); } catch (ParseException e) { throw new IllegalArgumentException( "Unrecognized DateAndTime value : " + dateStr + " (only UTC date is accepted)"); |
Date | parseDate(final String dateString) This method parses a Date from a string with the format dd.MM.yyyy kk:mm. Date date = null; DateFormat formatter; try { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); date = formatter.parse(dateString); } catch (final ParseException d) { try { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); ... |
Date | parseDate(final String pDate) Parse the given date using the #OCCURRENCE_DATE_FORMAT format. final SimpleDateFormat format = new SimpleDateFormat(OCCURRENCE_DATE_FORMAT); return format.parse(pDate); |
Date | parseDate(final String revision) parse Date final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { return formatter.parse(revision); } catch (final ParseException e) { throw new IllegalArgumentException("Date not valid", e); |
Date | parseDate(final String source) Parse the Date using pattern "yyyy-MM-dd" if (source == null || source.trim().length() == 0) { return null; return dateFormat.parse(source); |
Date | parseDate(final String source) parse Date return dateFormat.get().parse(source);
|
Date | parseDate(final String str) Parses a string representing a date by trying different date patterns. The following date patterns are tried (in the given order): "yyyy-MM-dd", "yyyy/MM/dd", "yyyyMMdd", "yyyy", "dd.MM.yyyy", "dd MMM yyyy", "dd MMM.if ("today".equalsIgnoreCase(str) || "now".equalsIgnoreCase(str)) { return new Date(); for (int i = 0; i < DATE_PATTERNS.length; i++) { DATE_PARSER.applyPattern(DATE_PATTERNS[i]); DATE_PARSE_POSITION.setIndex(0); final Date date = DATE_PARSER.parse(str, DATE_PARSE_POSITION); if (date != null && DATE_PARSE_POSITION.getIndex() == str.length()) { ... |
Date | parseDate(final String str, final Locale locale, final String... parsePatterns) parse Date return parseDateWithLeniency(str, locale, parsePatterns, true);
|
Date | parseDate(final String value) parse Date try { return getUtilDateFormat().parse(value); } catch (ParseException e) { return throwRuntimeParseException(value, e); |