Install a Timecounter

Hi,Is there an easy way to install a timecounter.The counter should be able to display the days/hours/minutes since a specific date. With a TimerTask it would be nice.Any good ideas?regards
[224 byte] By [Oleka] at [2007-11-27 5:53:07]
# 1

while (true) {

try { Thread.sleep(1000); } catch (InterruptedException e) {}

updateCounter();

}

// let's say you have a calendar with the beginning date

public void updateCounter() {

this.counterGUI.setTimeDisplayed(calendar.getTime());

}

calvino_inda at 2007-7-12 15:45:39 > top of Java-index,Java Essentials,Java Programming...
# 2

thanks for your posting.

I have a failure in my description of the problem.

This way is clear ... a counter since a given date.

The problem is to programm a countdown.

A way is to compute the difference of the finish-date with the current-date and then take the hour-value ... but this works only for countdowns less then 24 hours.

ideas?

Oleka at 2007-7-12 15:45:39 > top of Java-index,Java Essentials,Java Programming...
# 3
For date and time arithmetics, look at the Calendar and GregorianCalendar classes. There are also code examples using them out there.Greetings from another Ole
OleVVa at 2007-7-12 15:45:39 > top of Java-index,Java Essentials,Java Programming...