Here you can find the source of parseSQLDate(String dateStr, String pattern)
public static java.sql.Date parseSQLDate(String dateStr, String pattern) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String STANDARD_DATE_PATTERN = "yyyy-MM-dd"; public static java.sql.Date parseSQLDate(String dateStr, String pattern) throws ParseException { Date d = parse(dateStr, pattern); return new java.sql.Date(d.getTime()); }/*from www. ja va 2s. com*/ public static java.sql.Date parseSQLDate(String dateStr) throws ParseException { Date d = parse(dateStr, STANDARD_DATE_PATTERN); return new java.sql.Date(d.getTime()); } public static Date parse(String dateStr) { return parse(dateStr, STANDARD_DATE_PATTERN); } public static Date parse(String dateStr, String pattern) { try { DateFormat format = new SimpleDateFormat(pattern); return format.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); } return null; } }