In the example given below we will see, how to display current date and time in the user given format. To do all this we have first created instance of the calendar class that returns object of the same class whose time fields have been initialized with the current date and time. getTime() method returns current time of date type.
Here is the video tutorial of "How to get date and time in Java?":
Output will be displayed as:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: October 22, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles