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 date)
Returns a date from a string date in the format yyyy-MM-dd
try {
    return (date == null) ? null : dateFormat.parse(date);
} catch (ParseException e) {
    throw new IllegalArgumentException(e);
DateparseDate(String date)
Converte de String para Data
try {
    return sdf.parse(date);
} catch (ParseException ex) {
    return null;
DateparseDate(String date)
parse a date
Date result = null;
if (date.matches("\\d\\d\\d\\d-\\d(\\d)?-\\d(\\d)?")) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    result = sdf.parse(date);
} else if (date.matches("\\d(\\d)?-\\d(\\d)?-\\d\\d(\\d\\d)?")) {
    SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yy");
    result = sdf.parse(date);
} else if (date.matches("\\d(\\d)?-\\d(\\d)?")) {
...
DateparseDate(String date)
parse Date
DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
Date myDate2 = null;
try {
    myDate2 = dateFormat2.parse(date);
} catch (ParseException e) {
    e.printStackTrace();
    return null;
return myDate2;
DateparseDate(String date)
parse Date
return parseDate(date, DEFAULT_DATETIME_FORMAT);
DateparseDate(String date)
parse Date
try {
    return DATE_FORMAT.parse(date);
} catch (Exception e) {
    return null;
DateparseDate(String date)
parse Date
checkDateFormat();
try {
    return dateFormat.parse(date);
} catch (ParseException e) {
    return null;
DateparseDate(String date)
parse Date
return parseDate(date, DEFAULT_DATE_FORMAT);
DateparseDate(String date)
parse Date
return parseDate(date, DATE_FORMAT);
DateparseDate(String date)
parse Date
return parseDate(date, DATE_FORMATS);