Hi all
Is there any class to store time in easily, without having to store a date too?
We have to create a program for swimming competitions. The swimmers in a match need a time (the time they did swimming the match). So we only need hours, minutes, seconds and milliseconds.
Edit start:
I found the class Time too, but there you have to give in milliseconds since a certain date, which is not easy...
The constructor Time(int hour, int minute, int second) is deprecated...
Edit end.
Thanks in advance
Kenny
Ps: this may seem like a stupid question, but this is an example I found:
import java.util.*;
import java.text.*;
public class Apollo {
public static void main(String[] args) {
GregorianCalendar liftOffApollo11 = new GregorianCalendar(1969, Calendar.JULY, 16, 9, 32);
Date d = liftOffApollo11.getTime();
DateFormat df1 = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
DateFormat df2 = DateFormat.getTimeInstance(DateFormat.SHORT);
String s1 = df1.format(d);
String s2 = df2.format(d);
System.out.println(s1);
System.out.println(s2);
}
}
and here you need to give in a date too.