Date: getTime() : Date « java.util « Java by API






Date: getTime()

/*
 * Output: 

13263

 */

import java.util.Date;

public class MainClass {

  public static void main(String args[]) {
    Date currentDate = new Date();

    long msec = currentDate.getTime();
    
    long days = msec/(24 * 60 * 60 * 1000);

    System.out.println(days);
  }
}

           
       








Related examples in the same category

1.new Date()
2.new Date(int intValue)
3.Date: after(Date when)
4.Date: before(Date when)
5.Date: diff (Not a method)
6.Date: equals(Object anotherDate)
7.Date: setTime(long miliseconds)