Create java.util.Date from long value(milliseconds) in Java

Description

The following code shows how to create java.util.Date from long value(milliseconds).

Example


//from   w w w.  ja va 2s  .  co  m
import java.util.Date;

public class Main{

  public static void main(String[] args){
     Date date = new Date(1111111111);
     System.out.println(date); 
  }

}

The code above generates the following result.





















Home »
  Java Tutorial »
    Date »




Date Get
Date Set
Date Format
Date Compare
Date Convert
Date Calculation
Date Parse
Timezone