Japanese Imperial Calendar : New Locales « JDK 6 « Java

Japanese Imperial Calendar


import java.util.Calendar;
import java.util.Locale;
import java.util.Map;

public class JapaneseCalendar {
  public static void main(String args[]) {
    Locale locale = new Locale("ja", "JP", "JP");
    Calendar now = Calendar.getInstance(locale);

    Map<String, Integer> names = now.getDisplayNames(Calendar.ERA, Calendar.LONG, locale);
    System.out.printf("%s%n", names);
    System.out.printf("It is year %tY of the current era%n", now);
    System.out.printf("The calendar class is: %s%n", now.getClass().getName());


Related examples in the same category

1.New locales in Java 6
2.Locale Sensitive Services SPI
3.Displaying Calendar Names