List of utility methods to do Parse Date
java.util.Date | parseDate(String sDate) parse Date java.text.DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date retDate = null; try { retDate = formatter.parse(sDate); } catch (Exception ex) { return retDate; |
Date | parseDate(String sDate) parse Date SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd"); try { Date date = bartDateFormat.parse(sDate); return date; } catch (Exception ex) { return null; |
java.util.Date | parseDate(String sDate) Parse the given date ( supposed to be in ISO format : "YYYY-MM-DD" ) if (sDate == null) return null; if (sDate.length() == 0) return null; char c = 0; for (int i = 0; i < 10; i++) c = sDate.charAt(i); ... |
Date | parseDate(String sDate, Locale locale) parse Date Date date = parseW3CDateTime(sDate, locale); if (date == null) { date = parseRFC822(sDate, locale); if ((date == null) && (ADDITIONAL_MASKS.length > 0)) { date = parseUsingMask(ADDITIONAL_MASKS, sDate, locale); return date; ... |
java.util.Date | parseDate(String sDate, SimpleDateFormat _dateFormat) parse Date sDate = (sDate != null) ? sDate.trim() : null; if (sDate == null || sDate.length() == 0) return null; ParsePosition pp; java.util.Date d = null; try { pp = new ParsePosition(0); d = _dateFormat.parse(sDate, pp); ... |
java.util.Date | parseDate(String sDate, String sFormat) parse Date java.text.SimpleDateFormat formatter = null; java.util.Date utildate = null; formatter = new java.text.SimpleDateFormat(sFormat); utildate = formatter.parse(sDate); return utildate; |
String | parseDate(String sDate, String sSourceFormat, String sDestinationFormat) parse Date String sRtn = ""; try { sRtn = new java.text.SimpleDateFormat(sDestinationFormat) .format(new java.text.SimpleDateFormat(sSourceFormat).parse(sDate)); } catch (Exception ex) { ex.printStackTrace(); return sRtn; ... |
Date | parseDate(String sdate, String timeFormat, String timeZone) parse Date SimpleDateFormat sdf = getDateFormatter(timeFormat); TimeZone ltz = TimeZone.getDefault(); Date date; try { date = sdf.parse(sdate); } catch (ParseException pe) { throw new RuntimeException("Cannot parse date: " + sdate + "; " + pe.getMessage(), pe); Date nd = date; TimeZone tz = TimeZone.getTimeZone(timeZone); if (ltz.hasSameRules(tz) == false) { long lo = ltz.getRawOffset(); long to = tz.getRawOffset(); nd = new Date(date.getTime() - to + lo); return nd; |
Date | parseDate(String sDateTime, String sPattern) Parse the String to return a valid Date object. TimeZone timeZone = TimeZone.getDefault();
Date date = parseDate(sDateTime, sPattern, timeZone);
return date;
|
Date | parseDate(String source, String format) parse Date SimpleDateFormat sdf = new SimpleDateFormat(format); try { return sdf.parse(source); } catch (ParseException e) { return null; |