Java Data Type How to - Get date from the base date i.e 01/01/1970








Question

We would like to know how to get date from the base date i.e 01/01/1970.

Answer

//  w  w w  . j av  a2  s .c om
import java.time.LocalTime;

public class Main {
    public static void main(String[] args) {

      // Getting date from the base date i.e 01/01/1970
      LocalTime specificSecondTime = LocalTime.ofSecondOfDay(10000);
      System.out.println("10000th second time= " + specificSecondTime);
    }
}

The code above generates the following result.