Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;

public class Main {

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

        System.out.println(humanTime);
    }
}