> Hello,
>
> Does anyone now how to access the setTimeInMillis method of the Calendar
> Class.
Define "access". I generally get it this way:
long millis = new Calendar().getTimeInMillis();
Or:
long millis = System.currentTimeMillis();
Same result.
> I have a time in the format of HH:MM:SS: which is a string, but I
> want to
> convert it to a long, so I can compare the times to figure out of two
> times how far greater or lesser one is.
You only need time, yes? Not dates? And expressed in hours, minutes, and
seconds? Then you do not need a Calendar object, and you do not need
milliseconds. The simple way is to split the time string into sections and
multiply them together:
public class Test {
static int timeSecondsFromString(String s)
{
int t = 0;
String[] array = s.split(":");
if(array.length == 3) {
t = Integer.parseInt(array[0]) * 1440
+ Integer.parseInt(array[1]) * 60
+ Integer.parseInt(array[2]);
}
return t;
}
public static void main(String[]args)
{
if (args != null && args.length > 0) {
int timeSeconds = timeSecondsFromString(args[0]);
System.out.println(timeSeconds);
}
}
};
Input: 12:34:56
Output: 19376 seconds.
I will leave the time comparisons to you.

Signature
Paul Lutus
http://www.arachnoid.com