Android Date String Parse parseLongFormat(String dateString)

Here you can find the source of parseLongFormat(String dateString)

Description

parse Long Format

Declaration

public static Date parseLongFormat(String dateString) 

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 final String LOCAL_LONG_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static Date parseLongFormat(String dateString) {
        return parse(dateString, LOCAL_LONG_DATE_FORMAT);
    }// ww w  . j  a  va2  s. com
    public static Date parse(String dateString, String dateFormat) {
        if (StringUtil.isEmpty(dateString)
                || StringUtil.isEmpty(dateFormat)) {
            return null;
        }

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

        return date;
    }
}

Related

  1. parseDate(final String dateValue, String[] dateFormats)
  2. parseDate(final String dateValue, String[] dateFormats)
  3. parseDateStrictly(String str, String... parsePatterns)
  4. parseDateTime(String dateString)
  5. parseDateWithLeniency(String str, String[] parsePatterns, boolean lenient)
  6. parseSearchApiDateTime(String dateString)
  7. parseString(String dateStr)
  8. parseString(String dateStr, String pattern)
  9. parseStringToDate(String str)