MySQL’s default DATE field format is: YYYY-MM-DD
Whereas in Java, the Date class’ (available in java.util package) default format is,dow mon dd hh:mm:ss zzz yyyy
so use this:
Date date = txtToday.getText();
String pattern = "yyyy-MM-dd";
SimpleDateFormat formatter = new SimpleDateFormat(pattern);
String mysqlDateString = formatter.format(date);
System.out.println("Java's Default Date Format: " + date);
System.out.println("Mysql's Default Date Format: " + mysqlDateString);