Java String to Date StringToDate(String format, String dateStr)

Here you can find the source of StringToDate(String format, String dateStr)

Description

String To Date

License

Open Source License

Declaration

public static Date StringToDate(String format, String dateStr) 

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 StringToDate(String format, String dateStr) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        try {// www.j  a  v  a  2  s. com
            Date date = dateFormat.parse(dateStr.trim());
            return date;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. stringToDate(String dateString, String pattern)
  2. stringToDate(String dateText, String format, boolean lenient)
  3. StringToDate(String Expression)
  4. StringToDate(String fecha)
  5. stringToDate(String fecha, String formato)
  6. stringToDate(String input)
  7. stringToDate(String pstrValue, String pstrDateFormat)
  8. stringToDate(String s)
  9. StringToDate(String s)