Whenever I try to enter the date into the database using my JavaFX JFXDatePicker in the application. However, it always enters the date as '1992'. I don't even have 1992 available in the choices.
When I print the DatePicker.getValue() the correct date is being printed to the console. This is the code:
public void RemRoom() {
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
con = DriverManager.getConnection("jdbc:sqlite:Rooms.db");
pst = con.prepareStatement("UPDATE " + tp + " set isAvail = 'false' where RoomID = '" + rm + "'");
pst.execute();
LocalDate sd = ControllerScr2.getInstance().chkIn.getValue();
System.out.println(sd);
pst = con.prepareStatement("UPDATE " + tp + " set StartDate = " + sd + " where RoomID = '" + rm + "'");
pst.execute();
pst.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}


REAL. This means you do not have to give them a date directly, but first convert it to the correct format. For this purpose,SQLiteoffers thejuliandayfunction that accepts as a string argument containing the date and returns a value of typeREAL