Java Program to Find Current Date and Time

We can find current date and time in Java in two ways. The first way is to use Date class and second way is to use Calendar class. Below I have shared Java program to find current date and time. First I am defining the date and time format using DateFormat and SimpleDateFormat class and then I am using format() and getTime() method to get current date and time. The program is self explainable but still if you are getting any difficulty then you ask in comment section.

Java Program to Find Current Date and Time

 

Output

Java Program to Find Current Date and Time

Leave a Comment

Your email address will not be published. Required fields are marked *