If you use a prepared statement, and a java.sql.Date object, then the standard format of the date that the database uses is irrelevant.
You then use a java.text.SimpleDateFormat to convert a String to a date.
You can also use it to validate whatever format you like.
Instead of
sql = "Insert into birthday(date) values ('" + birthDay +"')";
have
String sql = "Insert into birthday(date) values (?)";
String sDate = ?
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // or whatever format you want
java.util.Date birthDate = null;
try{
birthDate = sdf.parse(sDate);
}
catch(ParseException e){
// an error parsing the date. Send an error message back to the client
}
java.sql.Date sqlDate = new java.sql.Date(birthDate.getTime());
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setDate(1, sqlDate);
stmt.execute();