Here you can find the source of getSqlDate(String str)
public static java.sql.Date getSqlDate(String str)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; public class Main { public static java.sql.Date getSqlDate(String str) { try {/*from www. ja v a2 s . co m*/ if (str == null || str.equals("")) { return null; } DateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd"); java.util.Date tempDate = df.parse(str); return new java.sql.Date(tempDate.getTime()); } catch (ParseException ex) { return null; } } }