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

DateparseDate(String s)
parse Date
if (s != null) {
    try {
        return ISO8601Utils.parse(s, new ParsePosition(0));
    } catch (ParseException e) {
        return null;
return null;
...
DateparseDate(String s)
parse Date
try {
    return DATE_FORMAT.parse(s);
} catch (ParseException e) {
try {
    if (s != null && s.startsWith("@"))
        return new Date(Long.parseLong(s.substring(1)));
} catch (IllegalArgumentException iae) {
...
DateparseDate(String s)
parse Date
DateFormat dateLong = new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss");
DateFormat dateOnly = new SimpleDateFormat("yyyy/MM/dd");
DateFormat dateTime = new SimpleDateFormat("HH:mm:ss");
try {
    return dateLong.parse(s);
} catch (Exception e) {
    try {
        return dateOnly.parse(s);
...
DateparseDate(String s)
parse Date
if (s == null || s.length() == 0) {
    return null;
} else {
    if (s.length() == 10) {
        s += " 00:00:00";
    return df.parse(s);
DateparseDate(String s)
parse Date
if (s == null)
    return null;
return dfDate.parse(s);
DateparseDate(String s)
parse Date
try {
    Date date = FORMATTER.parse(s);
    return date;
} catch (Exception e) {
    throw new RuntimeException("unable parse date time from string [" + s + "]", e);
DateparseDate(String s)
Parses text in 'YYYY-MM-DD' format to produce a date.
return FORMAT_YYYY_MM_DD.parse(s);
java.util.DateparseDate(String s)
parse Date
try {
    return DATE_FMT2.parse(s);
} catch (Exception e) {
    try {
        return DATE_FMT.parse(s);
    } catch (Exception e2) {
        return null;
Dateparsedate(String s, SimpleDateFormat fmt)
parsedate
synchronized (fmt) {
    try {
        return fmt.parse(s);
    } catch (ParseException e) {
        throw new RuntimeException(e);
DateparseDate(String s, String format)
Utility method to parse a date in the given format
DateFormat df = new SimpleDateFormat(format);
try {
    return df.parse(s);
} catch (Exception e) {
    throw new RuntimeException("Cannot parse " + s + " into a date using format " + format);