Java Date create from milliseconds

Description

Java Date create from milliseconds

import java.util.Date;
 
public class Main {
 
  public static void main(String[] args) {
   //from w w w .ja va 2  s  .  c  o m
    //date after two years of January 1, 1970, 00:00:00 GMT
    
    int year = 2;
    Date d = new Date(year * 365L * 24L * 60L * 60L * 1000L);
    System.out.println(d);
  }
}



PreviousNext

Related