List of utility methods to do Parse Date Pattern YYYY
Date | parseW3CDateRobust(String dateString) parse WC Date Robust try { return parseW3CDate(dateString); } catch (ParseException e) { return parseW3CDateWithFractionalSeconds(dateString); |
Date | parseW3CDateTime(String date) parse WC Date Time int tIndex = date.indexOf("T"); if (tIndex > -1) { if (date.endsWith("Z")) { date = date.substring(0, date.length() - 1) + "+00:00"; int tzdIndex = date.indexOf("+", tIndex); if (tzdIndex == -1) { tzdIndex = date.indexOf("-", tIndex); ... |
Date | parseW3CDateTime(String sDate, Locale locale) parse WC Date Time int tIndex = sDate.indexOf("T"); if (tIndex > -1) { if (sDate.endsWith("Z")) { sDate = sDate.substring(0, sDate.length() - 1) + "+00:00"; int tzdIndex = sDate.indexOf("+", tIndex); if (tzdIndex == -1) { tzdIndex = sDate.indexOf("-", tIndex); ... |
Date | parseWsDate(String date) parse Ws Date return parseDate(date, WS_DATE_FORMAT);
|
Date | parseXEP0082Date(String dateString) Parses the given date string in the XEP-0082 - XMPP Date and Time Profiles format. synchronized (XEP_0082_UTC_FORMAT) { return XEP_0082_UTC_FORMAT.parse(dateString); |
String | parseXsdDate(final Date date) parse Xsd Date String temp = new SimpleDateFormat(DATE_FORMAT_STRING).format(date); return temp.substring(0, temp.length() - 2) + ":" + temp.substring(temp.length() - 2, temp.length()); |
Date | parseXsdDateTime(String date) Parses a String that is formatted according to the xsd:dateTime data type and returns it as a Date String newDate = date.trim(); if (newDate.endsWith("Z")) { newDate = newDate.substring(0, newDate.length() - 1) + "+0000"; } else { int colonPos = newDate.lastIndexOf(":"); newDate = newDate.substring(0, colonPos) + newDate.substring(colonPos + 1, newDate.length()); return XSD_DATE_TIME_FORMAT.parse(newDate); ... |
Date | parseYmd(String date) parse Ymd return parseDate(date, "yyyy-MM-dd"); |
Date | parseYmd(String s) Utility method to parse a date in the given format DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { return df.parse(s); } catch (Exception e) { throw new RuntimeException("Cannot parse " + s + " into a date using ymd format"); |
Date | parseYmdDate(String dateString) parse Ymd Date if (dateString == null) { return null; Date date; SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); try { date = fmt.parse(dateString); } catch (ParseException e) { ... |