JapaneseCalendar.java Source code

Java tutorial

Introduction

Here is the source code for JapaneseCalendar.java

Source

/*
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);
    }
}