List of utility methods to do Parse Date
Date | parseDate(String strFormat, String dateValue) Parse a string and return the date value in the specified format if (dateValue == null) return null; if (strFormat == null) { strFormat = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat dateFormat = new SimpleDateFormat(strFormat); Date newDate = null; try { ... |
Date | parseDate(String string) parse Date Date result = new Date(); DateFormat format = new SimpleDateFormat("M/d/y h:m a"); try { result = format.parse(string); } catch (ParseException e) { e.printStackTrace(); return result; ... |
Date | ParseDate(String string, String format) Tries to parse string into a Date(+time), using given format. try { return new SimpleDateFormat(format).parse(string); } catch (ParseException exc) { return null; |
Date | parseDate(String t) Parse a date string for (DateFormat df : DATE_FORMATS) { try { return df.parse(t); } catch (ParseException e) { return null; |
Date | parseDate(String text) parse Date if (text == null) return null; Matcher matcher = TZ_REGEX.matcher(text); TimeZone timeZone = null; if (matcher.find()) { String tzCode = "GMT" + matcher.group(1) + matcher.group(2); timeZone = TimeZone.getTimeZone(tzCode); DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); if (timeZone != null) { formatter.setTimeZone(timeZone); try { Date result = formatter.parse(text); return result; } catch (ParseException e) { return null; |
boolean | parseDate(String text, String[] datePattern, int index) parse Date if (index == datePattern.length) { return false; SimpleDateFormat format = new SimpleDateFormat(datePattern[index]); format.setLenient(false); try { format.parse(text); return true; ... |
long | parseDate(String time) parse Date if (time == null) return System.currentTimeMillis(); try { Date date = getDateFormat().parse(time); return date.getTime(); } catch (ParseException e) { return System.currentTimeMillis(); |
long | parseDate(String time) parse Date try { return rfcFormat.parse(time).getTime(); } catch (ParseException e) { return isoFormat.parse(time).getTime(); |
Date | parseDate(String timeString) parse Date sFormat = new SimpleDateFormat(DETAIL_TIME_FORMAT, Locale.CHINA); try { return sFormat.parse(timeString); } catch (ParseException e) { e.printStackTrace(); return null; |
Date | parseDate(String token) parse Date Date retval = null; try { retval = _DATE_FORMAT.parse(token); } catch (final Exception e) { retval = null; return retval; |