Java Date from String convertToDate(String dateString)

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

Description

convert To Date

License

Open Source License

Exception

Parameter Description
ParseException an exception

Declaration

public static Date convertToDate(String dateString) throws ParseException 

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 final String DATEFORMAT = "yyyy-MM-dd";

    /**/* w  w w.j a  v a 2  s .co  m*/
     * @throws ParseException 
     * 
     */
    public static Date convertToDate(String dateString) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat(DATEFORMAT);
        Date date = sdf.parse(dateString);

        return date;
    }
}

Related

  1. convertToDate(final String str, final DateFormat dateFormat)
  2. convertToDate(String date)
  3. convertToDate(String dateAsString)
  4. convertToDate(String dateString, String format)
  5. convertToDate(String dateString, String pattern)
  6. convertToDate(String ddMMyy)
  7. convertToDate(String inDate)