Java Parse Date parseDateWithFormat(String date, SimpleDateFormat dateFormat, Date defaultDate)

Here you can find the source of parseDateWithFormat(String date, SimpleDateFormat dateFormat, Date defaultDate)

Description

parse Date With Format

License

Open Source License

Declaration

public static Date parseDateWithFormat(String date, SimpleDateFormat dateFormat, Date defaultDate) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static Date parseDateWithFormat(String date, SimpleDateFormat dateFormat, Date defaultDate) {
        try {/*from  w  w  w .j ava  2  s  .  c  o m*/
            return dateFormat.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return defaultDate;
    }
}

Related

  1. parseDateToString(Date date, String format)
  2. parseDateToString(Date date, String pattern)
  3. parseDateToString(Date datetime)
  4. parseDateToString(final Date date, final String dateFormat, final String lang)
  5. parseDateValue(String value)
  6. parseDateWithLeniency(final String str, final Locale locale, final String[] parsePatterns, final boolean lenient)
  7. parseDateWithoutTime(final String date)
  8. parseDateWithPattern(Date value, String pattern)
  9. parseDateWithPattern(String dateValue, String pattern)