Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
    public static void main(String[] argv) {
        LocalDate ld = LocalDate.now();
        String ldStr = ld.format(DateTimeFormatter.ISO_DATE);
        System.out.println("Local  Date: " + ldStr);

        OffsetDateTime odt = OffsetDateTime.now();
        String odtStr = odt.format(DateTimeFormatter.ISO_DATE);
        System.out.println("Offset  Datetime: " + odtStr);

        ZonedDateTime zdt = ZonedDateTime.now();
        String zdtStr = zdt.format(DateTimeFormatter.ISO_DATE);
        System.out.println("Zoned  Datetime: " + zdtStr);
    }
}