Android Date String Parse parse(String dateString, String dateFormat)

Here you can find the source of parse(String dateString, String dateFormat)

Description

parse

Declaration

public static Date parse(String dateString, String dateFormat) 

Method Source Code

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main{
    public static Date parse(String dateString, String dateFormat) {
        if (StringUtil.isEmpty(dateString)
                || StringUtil.isEmpty(dateFormat)) {
            return null;
        }/*from  w w w .jav a2  s.  co  m*/

        SimpleDateFormat format = new SimpleDateFormat(dateFormat,
                Locale.ENGLISH);
        Date date = null;
        try {
            date = format.parse(dateString);
        } catch (Exception ex) {
        }

        return date;
    }
}

Related

  1. isDateString(String dirtyDate)
  2. isDateTimeString(String dirtyDateTime)
  3. parse(String date)
  4. parse(String date, String format)
  5. parse(String date, boolean isDateOnly)
  6. parse(String src)
  7. parseDA(String s, boolean end)
  8. parseDT(String s, boolean end)
  9. parseDate(String atomPubDate)