You need to handle the exception, when you parse a date. Put the code you are using to parse date or/and time in try..catch block, and it will not show you an error! try{ dateChooser.setDateFormatString("yyyy-MM-dd HH:mm:ss"); dateChooser.setBounds(419, 89, 175, 20); frame.getContentPane().add(dateChooser); final String start = (((JTextField)dateChooser.getDateEditor().getUiComponent()).getText()); DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd...