Formatting and Parsing a Time for a Locale: specify the locale when creating the SimpleDateFormat object.
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class Main {
public static void main(String[] argv) throws Exception {
Locale locale = Locale.FRENCH;
DateFormat formatter = new SimpleDateFormat("HH:mm:ss zzzz", locale);
String s = formatter.format(new Date());
System.out.println(s);
}
}
Related examples in the same category