How to create Date from specific time in Java

1 Answer

0 votes
package javaapplication1;

import java.util.Date;

public class JavaApplication1 {
    
    public static void main(String[] args) {
  
        // calculate 40 years after January 1, 1970, 00:00:00 GMT
        Date d = new Date(40L * 365L * 24L * 60L * 60L * 1000L);
        System.out.println(d);
    }  
}
   
/*
   
run:
   
Tue Dec 22 02:00:00 IST 2009
   
*/

 



answered Oct 29, 2016 by avibootz
...