Here you can find the source of convertToSqlDate(String str)
public static java.sql.Date convertToSqlDate(String str)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static java.sql.Date convertToSqlDate(String str) { SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd"); java.sql.Date sqlDate = null; try {/*from w w w . j a va 2 s .c om*/ java.util.Date date = bartDateFormat.parse(str); sqlDate = new java.sql.Date(date.getTime()); } catch (Exception ex) { System.out.println(ex.getMessage()); } return sqlDate; } }