Format is an abstract class that is used for formatting local-sensitive information like date, number and message. The Format class derived from the package java.text.format. The Date class is used to a specific instant time in millisecond time.
In this Tutorial we want to describe you a code that helps you to describe Get Time Now. For this we have a class name Get Time Now. Inside the main method we declare a String variable s,Format formatter and instantiate date class. The Simple Date Format display the time in a specific format as passed in argument of variable formatter. The variable formatter call a format method ( ) and pass the date object as argument ,that returns you the current Time in a specified format and store in a string variable, The System.out.println prints the current time from string variable 's'.
Date date = new Date( ) - This is used to instantiate the date class and allocate the memory to a date object, such that it represent the time allocated to it in the nearest millisecond.
GetTimeNow.java
|
Time : 03:34:34
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Get Time Now
Post your Comment