我正在开发一个 Java SE 僧伽罗语 Unicode 应用程序项目,我想用僧伽罗语显示日期。在 stackoverflow 上搜索后,我发现我可以使用 ICU4J,但它不起作用。
这是我使用过的代码
ULocale locale = ULocale.forLanguageTag("si-LK");
dfDate = new SimpleDateFormat("MMMMM d, YYYY", locale.toLocale());
date = new Date();
lblDate.setText(dfDate.format(date));
但它仍然给出英文输出。
为我工作。
ජ 7, 2014
。确保您在导入中使用 ICU 的 SimpleDateFormat
。
Locale locale = new Locale("si", "LK");
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
String date = dateFormat.format(new Date());
System.out.print(date);