List of utility methods to do Parse Date Pattern YYYY
Date | parseStringToDate(String date) parse String To Date Date result = null; String parse = date; parse = parse.replaceFirst("^[0-9]{4}([^0-9])", "yyyy$1"); parse = parse.replaceFirst("^[0-9]{2}([^0-9])", "yy$1"); parse = parse.replaceFirst("([^0-9])[0-9]{1,2}([^0-9])", "$1MM$2"); parse = parse.replaceFirst("([^0-9])[0-9]{1,2}( ?)", "$1dd$2"); parse = parse.replaceFirst("( )[0-9]{1,2}([^0-9])", "$1HH$2"); parse = parse.replaceFirst("([^0-9])[0-9]{1,2}([^0-9])", "$1mm$2"); ... |
java.util.Date | parseStringToDate(String dateString) parse String To Date java.text.SimpleDateFormat dfparser; dateString = dateString.replaceAll("th", ""); dateString = dateString.replaceAll("nd", ""); dateString = dateString.replaceAll("\\n", " "); dateString = dateString.replaceAll("\\r", " "); dateString = dateString.replaceAll(System.getProperty("line.separator"), " "); dateString = dateString.replaceAll("\\s{2,}", " "); try { ... |
String | parseStringToDatePrettyPrint(Date date) Converts a Date object into a String object for pretty printing.
return pretty_format.format(date);
|
java.util.Date | parseStringToUtilDate(String strDate) parse String To Util Date java.util.Date date = null; try { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); date = df.parse(strDate); } catch (Exception ex) { ex.printStackTrace(); return date; ... |
Date | parseTIPPDate(String dateString) parse TIPP Date try { SimpleDateFormat df = new SimpleDateFormat(FORMAT); return df.parse(dateString); } catch (ParseException e) { throw new IllegalArgumentException("Invalid date string: " + dateString); |
Date | parseToDate(final String date, final String format) Parses the String date to a date object. final DateFormat df = new SimpleDateFormat(format); Date parsedDate = null; parsedDate = df.parse(date); return parsedDate; |
Date | parseToDate(String date) parse To Date Date parsedDate = null; try { parsedDate = shortDateFormat.parse(date); } catch (Exception e) { return parsedDate; |
Date | parseToDate(String date, String format) parse To Date if (date == null) return null; Date dDate = null; if (format != null) { DateFormat formater = new SimpleDateFormat(format); dDate = formater.parse(date); } else { DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); ... |
Date | parseToDateLenient(final String date, final String format, final boolean lenient) Parses the String date to a date object. if (date == null || format == null || format.length() <= 0) { return null; final DateFormat df = new SimpleDateFormat(format); df.setLenient(lenient); Date parsedDate = null; try { parsedDate = df.parse(date); ... |
GregorianCalendar | parseToGregorianCalendar(String dateString) parse To Gregorian Calendar DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_STRING); GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone(GMT_TIMEZONE)); calendar.setTime(dateFormat.parse(dateString)); return calendar; |