List of utility methods to do Date String Parse
String | convertDateTimeStrFormat(String dateStr, String pattern, String newPattern) convert Date Time Str Format return DateTimeUtil.formatCalendar(
DateTimeUtil.parseString(dateStr, pattern), newPattern);
|
Date | convertStringToDate(String strDate, String pattern) convert String To Date DateFormat df = new SimpleDateFormat(pattern, Locale.US); Date date = null; strDate = strDate.replace("T", " "); try { date = df.parse(strDate); } catch (ParseException e) { e.printStackTrace(); return date; |
long | parse(String pattern, String date) parse final SimpleDateFormat sdf = new SimpleDateFormat(pattern); try { return sdf.parse(date).getTime(); } catch (ParseException e) { e.printStackTrace(); return 0; |
Date | parse3339(String time) parse final Time t = new Time(); t.parse3339(time); return new Date(t.toMillis(false)); |
Date | parseDate(String date) parse Date try { return DATE_FORMATOR.parse(date); } catch (Exception e) { return null; |
long | parseDate(String date) parse Date return parse(DATE_FORMAT, date);
|
Date | parseDate(String rawDate) parse Date try { return PARSER_GRIND.parse(rawDate); } catch (ParseException e) { return new Date(); |
String | parseDateStr(String dateStr, String srcPattern, String destPattern) parse Date Str if (isEmpty(dateStr)) { return null; if (isEmpty(srcPattern)) { srcPattern = "yyyy-MM-dd HH:mm:ss"; if (isEmpty(destPattern)) { destPattern = "yyyy-MM-dd"; ... |
Date | parseDateString(String dateStr, String pattern) parse Date String return parseDateString(dateStr, pattern, Locale.getDefault());
|
Date | parseDateString(String dateStr, String pattern, Locale locale) parse Date String SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, locale); return dateFormat.parse(dateStr, new ParsePosition(0)); |