How to convert Date into milliseconds in Java

1 Answer

0 votes
package javaapplication1;

import java.util.Date;

public class JavaApplication1 {
    
    public static void main(String[] args) {
  
        Date d = new Date();
  
        System.out.println("Milliseconds since January 1, 1970, 00:00:00 GMT to " 
                           + d + " is: " + d.getTime());
    }  
}
   
/*
   
run:
   
Milliseconds from January 1, 1970 to Sat Oct 29 09:58:25 IDT 2016 is: 1477724305771
   
*/

 



answered Oct 29, 2016 by avibootz

Related questions

1 answer 133 views
1 answer 160 views
1 answer 130 views
...