Java String to Date getStringToDate(String pValue, String pDateFormat)

Here you can find the source of getStringToDate(String pValue, String pDateFormat)

Description

get String To Date

License

Open Source License

Declaration

public static Date getStringToDate(String pValue, String pDateFormat) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date getStringToDate(String pValue, String pDateFormat) {
        try {/* w  w  w  .ja  v a2s. c o  m*/
            SimpleDateFormat formatter = new SimpleDateFormat(pDateFormat);
            formatter.setLenient(false);
            return formatter.parse(pValue);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. addTimeToDate(String date, int value, String unit, String sFormat)
  2. getStringToDate(String date, String format)
  3. getStringToDate(String date, String inputDateFormat)
  4. getStringToDate(String str)
  5. getStringToDateFull(String da)
  6. getStringToDateTime(String dateStr, String formatStr)
  7. getTodateString()