List of utility methods to do Parse Date
Calendar | parseDateTime(String fullDateParam, String unixDateParam, Map Parses datetime (firstly formated by DATE_FORMAT then unix format). String[] fullDateStrArr = request.get(fullDateParam); if (fullDateStrArr != null && fullDateStrArr.length == 1) { String dateStr = fullDateStrArr[0]; return parseFullDate(fullDateParam, dateStr); String[] unixDateStrArr = request.get(unixDateParam); if (unixDateStrArr != null && unixDateStrArr.length == 1) { String dateStr = unixDateStrArr[0]; ... |
long | parseDateTime(String s) Parses a date from a string. DateFormat df = null; for (int i = 0; true; ++i) { switch (i) { case 0: df = new java.text.SimpleDateFormat("MMM d, yyyy K:m:s a", java.util.Locale.ENGLISH); break; case 1: df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, java.util.Locale.ENGLISH); ... |
Date | parseDateTime(String s) parse Date Time if (s == null || s.length() == 0) return null; for (DateFormat dateFormat : dateTimeParsers) { try { Date res = dateFormat.parse(s); return res; } catch (Exception e) { return null; |
Date | parseDateTime(String s) Converts a date in the form of "yy-MM-dd HH:mm:ss" to a Date object using the default time zone. return parseDateTime(s, null);
|
Calendar | parseDateTime(String s) Parses the date/time stamp from a given input parameter using one of the following formats
SimpleDateFormat f1 = new SimpleDateFormat("MM/dd/yyyy"); SimpleDateFormat f2 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); SimpleDateFormat f3 = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); SimpleDateFormat f4 = new SimpleDateFormat("EEE MM/dd/yyyy HH:mm:ss.ms"); SimpleDateFormat f5 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.zzzzzzz"); Date d = null; try { d = f1.parse(s, new ParsePosition(0)); ... |
Date | parseDatetime(String value) parse Datetime try { return DATETIME_FORMATTER.parse(value); } catch (ParseException e) { throw new RuntimeException("Cannot parse " + value); |
Date | parseDateTimeFromString(String datetime) parse Date Time From String Date date = tryToParse(datetime, RFC_822_DATE_FORMAT.get()); if (date == null) { date = tryToParse(datetime, RFC_850_DATE_FORMAT.get()); if (date == null) { date = tryToParse(datetime, ANSI_DATE_FORMAT.get()); return date; ... |
Date | parseDateTimeHuman(String dateString) parse Date Time Human DateFormat df = new SimpleDateFormat(DATE_TIME_PATTERN_HUMAN); Date date; try { date = df.parse(dateString); } catch (ParseException e) { date = new Date(); return date; ... |
Long | parseDateTimeString(final String date) parse Date Time String if (NULL.equals(date) || date == null || date.length() == 0) { return null; String tmp = date.replace('T', ' '); tmp = tmp.replaceAll("#", ":"); tmp = tmp.replaceAll(FILE_MILLISECOND_SEPERATOR, "."); tmp = tmp.replace("Z", " +0000"); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS zzz"); ... |
String | parseDateTimeString(String dateTime) Parse time stamp from elfcloud.fi server if (dateTime == null || dateTime.length() == 0) { return ""; Calendar c = Calendar.getInstance(); TimeZone z = c.getTimeZone(); SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); inputFormat.setTimeZone(TimeZone.getTimeZone("Etc/UTC")); SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm Z"); ... |