Print System Date and Time in Java

By | February 28, 2016

Print System Date and Time in Java Programming

Here’s a Simple Code To Print System Date and Time in Java Programming Language. This Java Program prints the Current Date and Time of the System that you’re logged in to. Hence, it may be different than the Actual Time if your System is configured to a different Time and Date Zone.

About The Program

This Java Program uses GregorianCalendar Class from java.util Package. There are several methods declared within the GregorianCalendar Class that provides Year, Hour, Second, Minute, Day and Month of the Year.

GregorianCalendar is a Subclass of Calendar Class that provides Standard Calendar System. The format of this Class is as follows:

public class GregorianCalendar extends Calendar

 

Code To Print System Date and Time in Java Programming

Also Read: Java Code To Check Public IP Address

 

Output

How To Print System Date and Time in Java Programming Language

In case you get any Compilation Errors with this Java Program To Display System Date and Time or you have any doubt about it, mention it in the Comment Section.

Let's Discuss