Here you can find the source of str2DateTime(String strDate)
public static Date str2DateTime(String strDate)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.util.Date; public class Main { /** yyyy-MM-dd HH:mm:ss **/ public static Date str2DateTime(String strDate) { DateFormat df = DateFormat.getDateTimeInstance(); Date date = null;//from w w w .j a v a2 s . c o m try { date = df.parse(strDate); } catch (ParseException e) { e.printStackTrace(); } return date; } }