I'd like to check if the system date (e.g. the current date) is before an expiry date before opening my software.
I have written the following code, however it throws a NumberFormatException
. Why might this be happening?
public class dateController implements Initializable {
@FXML Label lblDate;
Alert alert = new Alert(AlertType.INFORMATION);
@Override
public void initialize(URL location, ResourceBundle resources) {
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
Date date = new Date();
lblDate.setText(dateFormat.format(date));
String a ="19/09/2018";
String currentdate = lblDate.getText();
String LastRunDate = currentdate;
if(Integer.parseInt(currentdate) < Integer.parseInt(a)) {
alert.setHeaderText(null);
alert.setContentText("Successfull");
alert.show();
}
}
}