Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.time.LocalDate;
import java.time.LocalDateTime;

public class Main {
    public static void main(String[] argv) {
        LocalDate today = LocalDate.now();
        System.out.println(String.format("Year : %s Month : %s day : %s", today.getYear(), today.getMonthValue(),
                today.getDayOfMonth()));

        LocalDateTime time = LocalDateTime.now();
        System.out.println(
                String.format("Hour : %s Mins : %s Sec : %s", time.getHour(), time.getMinute(), time.getSecond()));

    }
}