Here you can find the source of strToDate(String str)
public static Date strToDate(String str)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date strToDate(String str) { Date date = null;/*from ww w. j a va 2s . co m*/ try { // date = java.sql.Date.valueOf(str); SimpleDateFormat sdate = new SimpleDateFormat("yyyy-MM-dd"); date = (Date) sdate.parse(str); } catch (Exception e) { e.getStackTrace(); } return date; } }