There can be multiple ways to print current date and time.
Using Date Class
Current date is Sat Mar 24 18:22:46 UTC 2018
Using Calender class
Day of week : 7 Day of year : 83 Week in Month : 4 Week in Year : 12 Day of Week in Month : 4 Hour : 6 Minute : 22 Second : 48 AM or PM : 1 Hour (24-hour clock) : 18
We can use calender and formatter class to print current date in a specific format.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Java Program to Display Current Date and Time
- C++ Program to print current Day, Date and Time
- Java Program to Display Current Hour and Current Minute
- Time difference between expected time and given time
- Date after adding given number of days to the given date
- C program to print digital clock with current time
- New Date-Time API in Java 8
- LocalDateTime of(date, time) method in Java with Examples
- Naming a thread and fetching name of current thread in Java
- Time Functions in Python | Set-2 (Date Manipulations)
- Convert timestamp to readable date/time in PHP
- Difference between Compile-time and Run-time Polymorphism in Java
- Get name of current method being executed in Java
- CharacterIterator current() method in Java with Examples
- StringCharacterIterator current() method in Java with Examples
- BreakIterator current() method in Java with Examples
- Java Program to Find Current Working Directory
- How to Get the Id of a Current Running Thread in Java?
- How to get Day, Month and Year from Date in Java
- Program to find the time after K minutes from given time
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Akanksha_Rai