does anyone know how to add minutes to currentTimeMillis. i am passing an integer t, which is how many minutes users would like to add to the currentTimeMillis() time_int. Is this possible in java? can anyone show me?
public void radioStartTime(int t)
{
time_int =(int)System.currentTimeMillis(); //casting long into int.
System.out.println(time_int);
}
Well, given that there are 1,000 milliseconds in a second and 60 seconds in a minute, you need to add 60,000 for each minute.
Hence:
I’d also be a little wary of converting the return value from
currentTimeMillis()back to anintdata type, you may want to keep it as alongso there’s less chance of losing range.