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

Publié le: 31 juillet 2023
sur la chaîne: 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);
}


Sur cette page du site, vous pouvez voir la vidéo en ligne Java program to display date and time, print date and time using java program. durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur The Disciplined learner 31 juillet 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,922 fois et il a aimé 86 téléspectateurs. Bon visionnage!