I have a code which shows me the current date and time when I run my application
DateFormat dateFormat = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");
Calen
public void ShowTime() {
new Timer(0, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Date d = new Date();
SimpleDateFormat s = new SimpleDateFormat("dd/MM/yyy hh:mm:ss a");
time.setText(s.format(d)); //time= jlabel
}
}).start();
}
Continuously Change time(refresh every second)