Java Parse Date parseDateLongFormat(String sDate)

Here you can find the source of parseDateLongFormat(String sDate)

Description

parse Date Long Format

License

Open Source License

Declaration

public static Date parseDateLongFormat(String sDate) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String longFormat = "yyyyMMddHHmmss";

    public static Date parseDateLongFormat(String sDate) {
        DateFormat dateFormat = new SimpleDateFormat(longFormat);
        Date d = null;/* w  w w. j  ava 2s. co m*/

        if ((sDate != null) && (sDate.length() == longFormat.length())) {
            try {
                d = dateFormat.parse(sDate);
            } catch (ParseException ex) {
                return null;
            }
        }

        return d;
    }
}

Related

  1. parseDateHHmm(java.util.Date date)
  2. parseDateHHMM(String hhmm)
  3. parseDateHMSMZ(String dateString)
  4. parseDateList(List dateList)
  5. parseDateLong(String date, Locale locale)
  6. parseDateLoose(String dateString)
  7. parseDateNewFormat(String sDate)
  8. parseDateNoTimeWithDelimit(String sDate, String delimit)
  9. parseDateOrTimeString(String aDateString, String aFormatString)