I have been looking and trying solutions provided on the web (and SO) for the last hour on how to use the Date type in Java but I can't seem to get it working. I am using NetBeans 11.2 and I am not used to Java and it is giving me a hard time (no pun intended). It seems that LocalDateTime, Date and Time are deprecated and that I should be using java.time.
To be honest, I don't know what to do anymore. I am trying to build a query with inputs value to save in mySQL database.
The source of the Date is from <input type="date">
SignIn.java (servlet) :
String birthDate = request.getParameter("data_birthdate");
        
UserDto userDto = null;
UserDao userDao = new UserDao(); 
        
try 
{ 
// Tried this 
    userDto = userDao.CreateUser(LocalDateTime.parse(birthDate));
// Tried that
    userDto = userDao.CreateUser(Date.parse(birthDate));
// Tried this 
    userDto = userDao.CreateUser(Time.parse(birthDate));
}
userDao.java (Dao) :
public void CreateUser(Date dateBirth) throws SQLException {
try {
        connect = db.getConnect();
        ps = connect.prepareStatement(SQL_CreateUser);
        ps.setDate(1, dateBirth);
        ps.executeUpdate();
    }
}
 
    