I need to set the time on the current date. The time string is always in 24 hour format but the result I get is wrong:
SimpleDateFormat df = new SimpleDate
private void setClock() {
Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e -> {
Calendar cal = Calendar.getInstance();
int second = cal.get(Calendar.SECOND);
int minute = cal.get(Calendar.MINUTE);
int hour = cal.get(Calendar.HOUR_OF_DAY);
eski_minut = minute;
if(second < 10){
time_label.setText(hour + ":" + (minute) + ":0" + second);
}else if (minute < 10){
time_label.setText(hour + ":0" + (minute) + ":0" + second);
}
else {
time_label.setText(hour + ":" + (minute) + ":" + second);}
}),
new KeyFrame(Duration.seconds(1))
);
clock.setCycleCount(Animation.INDEFINITE);
clock.play();
}