Java -Retrieve current date and time

Ask a question


I need to display JFrame with labels and next to these labels, the date and time at which they were typed.
For this I need to retrieve and display the date and time in a JLabel but I can not even recover those below in a simple format such as: DD/MM/YYYY and HH/ MM/SS.


You must use the Date class from the java.util package
Inside, you have the Date () constructor which creates the current date. To obtain a more readable form you do a:

Date myDate = new Date();  
// Display:  

Thanks to maily for this tip.

Progress bar in C#
C++: A simple program to find the total of five values