Here you can find the source of strToDate(String value, String pattern)
public static java.sql.Date strToDate(String value, String pattern)
//package com.java2s; //License from project: Apache License public class Main { public static java.sql.Date strToDate(String value, String pattern) { if (value.length() <= 10) value = value + " 00:00:00"; java.text.SimpleDateFormat format = new java.text.SimpleDateFormat(pattern); java.text.ParsePosition pos = new java.text.ParsePosition(0); return new java.sql.Date(format.parse(value, pos).getTime()); }/*from w w w. j a v a 2s.c o m*/ }