Java Data Type How to - Convert number of days to millisecond








Question

We would like to know how to convert number of days to millisecond.

Answer

//  ww  w  .j  av  a2 s . co m
public class Main{
  public static void main(String[] argv){
    System.out.println(daysToMillis(1));
  }
  public static long daysToMillis(long days)
  {
      long daysInMillis = days * 24L * 60L * 60000L;
      return daysInMillis;
  }

}

The code above generates the following result.