Java String to Date stringToDatetime(String string)

Here you can find the source of stringToDatetime(String string)

Description

string To Datetime

License

Apache License

Declaration

public static Date stringToDatetime(String string) throws ParseException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static Date stringToDatetime(String string) throws ParseException {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dateTime = dateFormat.parse(string);
        return dateTime;
    }/*from   w w w. j  a  va 2 s .  co m*/
}

Related

  1. StringToDateFormat(String str, String format)
  2. stringToDateInTimeZone(String time, String timeZone)
  3. stringToDateMetaData(String dateString)
  4. stringToDateTemporalCoverage(String dateString)
  5. stringToDatetime(String str, String format)
  6. stringToDateTime(String stringDate, String format)
  7. stringToDateWithFormat(String stringToConvert, String dateFormat)
  8. strMSShortToDate(String str_date)
  9. strToDate(final String str)