Click to See Complete Forum and Search --> : Display Gemany-type date in applet


strongcu
December 20th, 2002, 01:47 AM
I want to write a applet that display date and time in Germany.
If I write it by using class file and run with class file, it display correctly:

Date a = new Date(System.currentTimeMillis());
DateFormat oFmt=DateFormat.getDateInstance(DateFormat.LONG);
String sDate=oFmt.format(a);
System.out.println(sDate);

And it will diplay: "20. Dezember 2002", that's correct. But if I use an applet to display:

Date a = new Date(System.currentTimeMillis());
DateFormat oFmt=DateFormat.getDateInstance(DateFormat.LONG);
String sDate=oFmt.format(a);
g.drawString(sDate,5,30);

Then it will display: "December 20, 2002", it's English, not Germany.

I use Win2KAS English version, regional locale setting: Germany. Can you help me to display date in applet like "20. Dezember 2002". Thank you for reading.

Timo Hahn
December 20th, 2002, 01:54 AM
try using DateFormat oFmt=DateFormat.getDateInstance(DateFormat.LONG, Locale.GERMANY);

strongcu
December 30th, 2002, 05:03 AM
Yeah, I'm sorry that I didn't post enough information.
If I use JVM, then it can display date in Germany, but when I use JRE 1.3.1_03, and use code:

DateFormat oFmt=DateFormat.getDateInstance(DateFormat.LONG, Locale.GERMANY);

I still can not display date in Germany. Can I help you?