import java.io.*; import java.util.*; import java.text.*; public class SimpleDateFormatTest { public static void main(String args[]){ Date date; SimpleDateFormat formatter; String pattern = "yyyy년 M월 d일 a h시 m분"; String result; formatter = new SimpleDateFormat(pattern, new Locale("ko","KOREA")); // formatter = new SimpleDateFormat(pattern, Locate.KOREA); // formatter.applyPattern("yyyy년 M월 d일 a h시 m분"); date = new Date(); result = formatter.format(date); System.out.println("result : " + result); } public String en(String ko) { String new_str = null; try { new_str = new String(ko.getBytes("KSC5601"), "8859_1"); } catch(UnsupportedEncodingException ex) { } return new_str; } public String ko(String en) { String new_str = null; try { new_str = new String(en.getBytes("8859_1"), "KSC5601"); } catch(UnsupportedEncodingException ex) { } return new_str; } }
|