Java Coder
How to get the current date in Java?
2 Answer(s)      a year and 6 months ago
Posted in : Java Beginners

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

Advertisement
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