Java program to display date and time, print date and time using java program.

Published: 31 July 2023
on channel: The Disciplined learner
3,922
86

Java date and time program :- Java code to print or display current system date and time. This program prints current date and time. We are using GregorianCalendar class in our program. Java code to print date and time is given below :
public static void main(String[] args) {
int Day,Month,Year;
int Second,Minute,Hour;
GregorianCalendar date=new GregorianCalendar();
Day=date.get(Calendar.DAY_OF_MONTH);
Month=date.get(Calendar.MONTH);
Year=date.get(Calendar.YEAR);
Second=date.get(Calendar.SECOND);
Minute=date.get(Calendar.MINUTE);
Hour=date.get(Calendar.HOUR);
System.out.println("Current Date is :"+Day+"/"+(Month+1)+"/"+Year);
System.out.println("Current Time is :"+Hour+":"+Minute+":"+Second);
}


On this page of the site you can watch the video online Java program to display date and time, print date and time using java program. with a duration of hours minute second in good quality, which was uploaded by the user The Disciplined learner 31 July 2023, share the link with friends and acquaintances, this video has already been watched 3,922 times on youtube and it was liked by 86 viewers. Enjoy your viewing!