List of utility methods to do Parse Date Pattern YYYY
Calendar | parseString2Calendar(String date) parse String Calendar return parseString2Calendar(date, null);
|
Date | parseString2Date(String date) parse String Date return parseString2Date(date, null);
|
Date | parseString2Date(String sDate, String format) parse String Date if (format == null || "".equals(format)) { format = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.parse(sDate); |
Long | parseString2Long(String strDate) parse String Long return new Long(parseDate(strDate, FORMAT_STR_TIME).getTime()); |
Date | parseStringAsDate(String pattern, String value) parse String As Date try { SimpleDateFormat formatter = new SimpleDateFormat(pattern); return (value == null) ? null : formatter.parse(value); } catch (Exception e) { return null; |
Date | parseStringDate(String dateAsString) Parses a text date in a thread-safe way. synchronized (CU_PROPERTY_DATE_PARSER) { return CU_PROPERTY_DATE_PARSER.parse(dateAsString); |
String | parseStringDateToRmFormat(String date) Convert String from dd.MM.yyyy to yyyy-MM-dd. SimpleDateFormat sdfOld = new SimpleDateFormat("dd.MM.yyyy"); SimpleDateFormat sdfNew = new SimpleDateFormat("yyyy-MM-dd"); Date d; try { d = sdfOld.parse(date); } catch (ParseException e) { e.printStackTrace(); return null; ... |
Date | parseStringForDate(String dateString) parse String For Date String[] dateFormats = new String[] { "yyyy-MM-dd'T'HH:mm", "yyyy-MM-dd" }; for (int i = 0; i < dateFormats.length; i++) { Date date = attemptParse(dateString, dateFormats[i]); if (date != null) { return date; return null; ... |
Calendar | parseStringToCalendar(String strDate) parse String To Calendar java.util.Date date = parseStringToUtilDate(strDate); if (date == null) { return null; Calendar ca = Calendar.getInstance(); ca.setTime(date); return ca; |
Date | parseStringToDate(final String pDate, final String... pFormat) parse String To Date final DateFormat dateFormat; if (pFormat.length == 0) { dateFormat = new SimpleDateFormat(DEFAULT_FORMAT); } else { dateFormat = new SimpleDateFormat(pFormat[FORMAT_POSITION]); final Date parsedDate; try { ... |