Java DateFormat .getAvailableLocales ()

Syntax

DateFormat.getAvailableLocales() has the following syntax.

public static Locale [] getAvailableLocales()

Example

In the following code shows how to use DateFormat.getAvailableLocales() method.


import java.text.SimpleDateFormat;
import java.util.Locale;
//from w  ww.  j  av  a 2s.co  m
public class Main {

  static public void main(String[] args) {

    Locale list[] = SimpleDateFormat.getAvailableLocales();

    for (int i = 0; i < list.length; i++) {
      System.out.println(list[i].toString());
    }

    for (int i = 0; i < list.length; i++) {
      System.out.println(list[i].getDisplayName());
    }

    for (int i = 0; i < list.length; i++) {
      System.out.println(list[i].getDisplayName(Locale.FRANCE));
    }

  }
}




















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat