DateFormat.getTimeInstance(int style) has the following syntax.
public static final DateFormat getTimeInstance(int style)
In the following code shows how to use DateFormat.getTimeInstance(int style) method.
import java.text.DateFormat; import java.util.Date; //from w ww . j a va 2 s .c o m public class Main { public static void main(String[] argv) throws Exception { DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG); String s = dateFormat.format(new Date()); System.out.println(s); } }
The code above generates the following result.