Here you can find the source of convertStringToDate(String data)
public static Date convertStringToDate(String data)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date convertStringToDate(String data) { if (data == null || data.equals("")) return null; Date date = null;/*from w ww . j av a 2s. c o m*/ try { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); date = (java.util.Date) formatter.parse(data); } catch (ParseException e) { System.err.println(e.getMessage()); } return date; } }