How to get the current date in Java?

Hi,

I am new to Java and trying to write a program to get the current date. How to get the current date in Java?

Thanks

View Answers

January 5, 2014 at 11:35 AM

Hi,

Check the tutorial: Java program to get current date.

Thanks


January 5, 2014 at 11:42 AM

Hi,

To get the current date and time in Java you can use the following code:

Calendar currentDate = Calendar.getInstance();

and with the help of Formatter class you can format the date.

Check the tutorial: Java program to get current date.

Thanks









Related Tutorials/Questions & Answers:
Advertisements