New locales in Java 6 : New Locales « JDK 6 « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » JDK 6 » New Locales 




New locales in Java 6
 
/*
Language                  Country         Locale Identifier
Chinese (Simplified)      Singapore       zh_SG
English                   Malta           en_MT
English                   Philippines     en_PH
English                   Singapore       en_SG
Greek                     Cyprus          el_CY
Indonesian                Indonesia       in_ID
Japanese (Japanese calendar)  Japan       ja_JP_JP
Malay                     Malaysia        ms_MY
Maltese                   Malta           mt_MT
Spanish                   US              es_US
*/

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

import javax.swing.JOptionPane;

public class JapaneseCalendar {
  public static void main(String[] args) {
    Locale japanese = new Locale("ja""JP""JP");

    Calendar cal = Calendar.getInstance(japanese);
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, japanese);
    String str = df.format(cal.getTime());

    JOptionPane.showMessageDialog(null, str);
  }
}

        














Related examples in the same category
1.Locale Sensitive Services SPI
2.Displaying Calendar Names
3.Japanese Imperial Calendar
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.