Locale.US : Locale « java.util « Java by API






Locale.US

 
/*
 * Output:
Japan: 4/28/06
Korea: Apr 28, 2006
United Kingdom: 28 April 2006
United States: Friday, April 28, 2006
 * */

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

public class MainClass {
  public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;

    df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.KOREA);
    System.out.println("Korea: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.FULL, Locale.US);
    System.out.println("United States: " + df.format(date));
  }
}

           
         
  








Related examples in the same category

1.Locale.CANADA_FRENCH
2.Locale.GERMANY
3.Locale.ITALY
4.Locale.JAPAN
5.Locale.KOREA
6.Locale.TAIWAN
7.Locale.UK
8.new Locale(String language, String country, String variant)
9.Locale: getDefault()
10.Locale: getDisplayCountry()
11.Locale: getDisplayCountry(Locale inLocale)
12.Locale: getDisplayLanguage()
13.Locale: getDisplayName()
14.Locale: getDisplayName(Locale inLocale)
15.Locale: getDisplayVariant()
16.Locale: getDisplayVariant(Locale inLocale)
17.Locale: getISOCountries()
18.Locale.getISOLanguages()
19.Locale: setDefault(Locale newLocale)