title: Countdown timer with hh:mm:ss format in Java
body: <p>I have created a seconds countdown time program unfortunately I don't know how to convert it to hh:mm:ss format. I want to display it as hh:mm:ss on to the label I assigned it to. Just for the context, I have a database with this program where I can pull the seconds from the database. I want to pull the time format from the database though, but for some reason it won't work. I would really really appreciate it if you could help me with it. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>public class Event implements ActionListener {
      public void actionPerformed(ActionEvent e) {
            int count = (int)(Double.parseDouble(tf.getText())); \\tf is a label where I display the seconds int data from my database
            timerLabel.setText(String.valueOf(count));
            TimeClass tc = new TimeClass(count);
            timer = new Timer(1000, tc);
            timer.start();
       }
  }
  
  public class TimeClass implements ActionListener {
     int counter;
     public TimeClass(int counter) {
           this.counter= counter;
     }
     public void actionPerformed(ActionEvent tc) {
           counter--;
           if(counter &gt;= 1) {
                timerLabel.setText(String.valueOf(counter));
           }
           else {
                timer.stop();
                timerLabel.setText("Done!");
                Toolkit.getDefaultToolkit().beep();
           }
     }
  }
  </code></pre>