Java Data Type How to - Convert "machine time" to human units


We would like to know how to convert "machine time" to human units.


import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
/*w  w w .  ja  v  a 2s .  c  o  m*/
public class Main {

  public static void main(String[] args) {
    // Instant is useful for generating a time stamp to represent machine time.
    Instant timestamp =;
    // Convert "machine time" to human units
    LocalDateTime humanTime = LocalDateTime.ofInstant(timestamp, ZoneId.systemDefault());

The code above generates the following result.