List of utility methods to do Parse Date Pattern YYYY
Date | parseApplePurchaseDate(String dateStr) Apple IAP receipt purchase date string format: "purchase-date-pst" = "2012-07-12 05:54:35 America/Los_Angeles"; try { Date date = SDF_APPLE.parse(dateStr); return date; } catch (ParseException e) { return null; |
Date | parseArgument(String textDate) parse Argument DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); return df.parse(textDate, new ParsePosition(0)); |
DateTime | parseAscTime(String date) Parses an ASC formatted date string into a DateTime object DateTime dateTime = null; try { Date parsedDate = getDateFormat(ASC_FORMAT).parse(date); dateTime = new DateTime(parsedDate.getTime()).withZone(DateTimeZone.forID("GMT")); } catch (ParseException e) { dateTime = null; return dateTime; ... |
DateTime | parseAsDateTime(String date) parse As Date Time return new DateTime(parseDate(date)); |
Date | parseAtomDate(String date_str) parse Atom Date final String[] formats = { "yyyy-MM-dd'T'kk:mm:ss'Z'", "yyyy-MM-dd'T'kk:mm:ssz", "yyyy-MM-dd'T'kk:mm:ssZ", "yyyy-MM-dd'T'kk:mm:ss" }; for (int i = 0; i < formats.length; i++) { try { SimpleDateFormat format = new SimpleDateFormat(formats[i], Locale.US); return (format.parse(date_str)); } catch (ParseException e) { return (null); |
Date | parseBingDate(String dateString) parse Bing Date DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss'Z'"); df.setTimeZone(TimeZone.getTimeZone("GMT")); return parseDateString(dateString, df); |
Calendar | parseBitcoin(String calendarString) parse Bitcoin try { Date date = bitcoinFormatter.parse(calendarString); Calendar cal = new GregorianCalendar(); cal.setTime(date); return cal; } catch (ParseException e) { e.printStackTrace(); return null; |
String | parseCalendar2String(Calendar calendar) parse Calendar String return parseCalendar2String(calendar, null);
|
Calendar | parseCalendarString(String dateTimeString) Converts a dateTimeString and makes a Calendar object SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date date = null; try { date = dateFormat.parse(dateTimeString); } catch (ParseException e) { e.printStackTrace(); Calendar cal = Calendar.getInstance(); ... |
Date | parseCDADateFormat(String xsdDate) Marshall CDA date/time/zone format to java Date type. Date jDate = null; try { jDate = cdaDateTimeFormat.parse(xsdDate); } catch (ParseException ex) { try { jDate = cdaDateTimeNoZoneFormat.parse(xsdDate); } catch (ParseException ex1) { try { ... |