Java: Get current full date and time
6. Get Current Date and Time
Write a Java program to get the current date and time.
Sample Solution:
Java Code:
Sample Output:
Current full date and time is : 6-20-2017 14:51:24.303
N.B.: The result may varry for your system date and time.
Pictorial Presentation:
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Java program to display the current date and time in a custom format using SimpleDateFormat.
- Write a Java program to retrieve and print the current local date and time using Java 8 Date/Time API.
- Write a Java program to display the current date and time and update it every second on the console.
- Write a Java program to get the current date and time and compute the corresponding day of the week.
Go to:
PREV : Get Time in New York.
NEXT : Last Day of Current Month.
Java Code Editor:
Improve this sample solution and post your code through Disqus
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.