sean beacham wrote:surely there must be a statement for get current time in milliseconds for the day? :\
Jesper de Jong wrote:Another way:
Get a Calendar object, set it to today, and set the hours, minutes, seconds and milliseconds to 0. Call getTimeInMillis() on it.
Call System.currentTimeMillis() to get the current time in milliseconds. Subtract the value that you got above from it, and you have the number of milliseconds since midnight.
sean beacham wrote:will that refresh for every day?
Campbell Ritchie wrote:You can't use the && operator like that. I am not quite sure what that means, but do you mean you want a particular turn-on time? You would probably want if (min == minOn && hour == HourOn) . . .
By the way: there is a better way to fill your arrays, which I edited to shorten the lines.I am not sure why you need those String arrays at all. You can print out the numbers with the %d tag and not use Strings.
You're welcomesean beacham wrote:. . . thats working thankyou although values of 00-09 only produce 1 digit so 00=0 and 09=9 its strange! . . .
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |