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