Java Date Parse getDateFromRequestStringDate(String dateString)

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

Description

get Date From Request String Date

License

Open Source License

Declaration

public static Date getDateFromRequestStringDate(String dateString) 

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 getDateFromRequestStringDate(String dateString) {

        Date resDate = null;//from   w  ww  .  j a  v a2 s .  c om
        try {
            String dateSource = dateString;
            dateSource = dateSource.trim();
            dateSource = dateSource.replaceAll("T", " ");

            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                    "yyyy-MM-dd HH:mm:ss");
            //simpleDateFormat.
            resDate = simpleDateFormat.parse(dateSource);
        } catch (ParseException exc) {
            return null;
        }
        return resDate;
    }
}

Related

  1. getDateFromIsoString(String dateString)
  2. getDateFromISOString(String iso)
  3. getDateFromOffset(Date prevDate, int offset)
  4. getDateFromOriDateStr(String strDate)
  5. getDateFromRange(String date)
  6. getDateFromRFC822String(Object rfc822)
  7. getDateFromStr(DateFormat format, String s)
  8. getDateFromStr(String date)
  9. getDateFromStr(String inputDate, String inputFormatStr)