Here you can find the source of stringToDate(String dateStr)
public static Date stringToDate(String dateStr)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date stringToDate(String dateStr) { try {/*w ww. jav a 2 s. c o m*/ if (dateStr != null) return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr); } catch (Exception e) { e.printStackTrace(); System.gc(); } return null; } }