Java Utililty Methods Parse Date

List of utility methods to do Parse Date

Description

The list of methods to do Parse Date are organized into topic(s).

Method

StringparseDateString(String pattern, String dateString)
parse Date String
SimpleDateFormat df = new SimpleDateFormat(pattern);
try {
    return df.format(df.parse(dateString));
} catch (java.text.ParseException e) {
    e.printStackTrace();
return null;
DateparseDateString(String s)

Converts string to a date

return parseDateString(s, "MM/dd/yy");
DateparseDateString(TimeZone tz, String dateString)
parse Date String
return parseDateString(tz, dateString, "yyyy-MM-dd HH:mm:ss");
DateparseDateStringToDate(DateFormat format, String dateString)
parse Date String To Date
if (format != null) {
    synchronized (format) {
        try {
            return format.parse(dateString);
        } catch (ParseException e) {
            return null;
} else {
    return null;
DateparseDateStrShort(String date)
parse Date Str Short
return parse(date, DF_SHORT);
DateparseDateSubset(String value, String[] parsePatterns, Locale l, TimeZone tz)
parse Date Subset
Date d = null;
SimpleDateFormat parser = null;
ParsePosition pos = new ParsePosition(0);
for (int i = 0; i < parsePatterns.length; i++) {
    if (i == 0) {
        if (l == null) {
            parser = new SimpleDateFormat(parsePatterns[0]);
        } else {
...
DateparseDateTime(@Nullable String s)
parse Date Time
if (s == null) {
    return null;
try {
    DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
    return sdf.parse(s);
} catch (ParseException e) {
...
DateparseDateTime(final String dateTime)
parse Date Time
try {
    return dateTime == null ? null : dateTimeFormat.parse(dateTime);
} catch (ParseException e) {
    throw new IllegalArgumentException("Could not construct date from: " + dateTime);
DateparseDateTime(String _date)
parse Date Time
synchronized (m_ISO8601Local) {
    return m_ISO8601Local.parse(_date.replaceFirst(":(\\d\\d)$", "$1"));
DateparseDateTime(String currDate, String format)
parse Date Time
SimpleDateFormat dtFormatdB = null;
try {
    dtFormatdB = new SimpleDateFormat(format);
    return dtFormatdB.parse(currDate);
} catch (Exception e) {
    dtFormatdB = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try {
        return dtFormatdB.parse(currDate);
...