Here you can find the source of stringToDate(String str)
public static Date stringToDate(String str)
//package com.java2s; //License from project: Open Source License import java.util.Date; public class Main { public static Date stringToDate(String str) { // DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = null;//from w w w .j a v a2 s . c o m try { // 2012-02-24 date = java.sql.Date.valueOf(str); } catch (Exception e) { e.printStackTrace(); } return date; } }