DateFormat getTimeInstance() Method in Java with Examples
The getTimeInstance() Method of DateFormat class in Java is used to get the time formatter. This time formatter comes with default formatting style for a default locale.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public static final DateFormat getTimeInstance()
Parameter: The method does not take any parameters.
Return Value: The method returns a time formatter in a particular format.
Below programs illustrate the use of getTimeInstance() method in Java:
Object: java.text.SimpleDateFormat@8400729 3:42:13 AM
The Original: 03/28/2019 Object: java.text.SimpleDateFormat@8400729 3:42:19 AM