Java Date Parse convertStringToDate(String input)

Here you can find the source of convertStringToDate(String input)

Description

convert String To Date

License

Open Source License

Declaration

public static Date convertStringToDate(String input) 

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 {
    static final String DATEFORMAT = "yyyy-MM-dd HH:mm:ss";

    public static Date convertStringToDate(String input) {
        SimpleDateFormat formatter = new SimpleDateFormat(DATEFORMAT);
        Date date = null;/*from   www.ja  v  a 2s  . c o m*/
        try {
            date = formatter.parse(input);
        } catch (ParseException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }
        return date;
    }
}

Related

  1. convertStringToDate(String dateString, String pattern)
  2. convertStringToDate(String dateText)
  3. convertStringToDate(String dateTime)
  4. convertStringToDate(String dateTime)
  5. convertStringToDate(String dt)
  6. convertStringToDate(String s)
  7. convertStringToDate(String str)
  8. convertStringToDate(String str, String pattern)
  9. convertStringToDate(String str_date)