"Mark Space" <> wrote in message
news:s917h.11134$ et...
> Luc The Perverse wrote:
>> you a hint - there is no zeroth hour
>
> Well, in military time there is. Maybe he can get the result he wants by
> changing the formatting of the output. Left as an exercise for the
> reader, I'm too lazy to look it up.
He needs to use the classes in the way they were indended, not find
workarounds.
What is wrong with something like this?
String fTime(int numSecs){
int se = numSecs%60;
numSecs/=60;
int mi = numSecs%60
int hr = numSecs/60;
String[] va = {"0" + Integer.toString(hr), "0" + Integer.toString(mi),
"0" + Integer.toString(se)};
String ret = "";
for(String c : va){
if(!ret.equals(""))
ret+=":";
ret+=c.substring(c.length() - 2);
}
return ret;
}
(Note I have not compiled this - so it may have errors)
--
LTP