Mega Code Archive

 
Categories / Java Tutorial / Database
 

Creating java sql Date Using the java sql Date valueOf() Method

The java.sql.Date object's valueOf() method accepts a String, which must be the date in JDBC time escape format: YYYY-MM-DD. public class MainClass {   public static void main(String[] args) {     String date = "2000-11-01";     java.sql.Date javaSqlDate = java.sql.Date.valueOf(date);   } }