2

I tried to use date variable and show on console using format but it shows Thai. How can I force it to show English?

Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat ("E M y 'at' hh:mm:ss");
System.out.println(ft.format(dNow));

The result is

พ. 12 2558 at 09:06:32

ps. expected result

Thursday 12 2015 at 09:06:32

I have tried this way but it doesn't work. How to set eclipse console locale/language

Community
  • 1
  • 1

1 Answers1

2

You can force your eclipse to be in english language completely:

  • Go to the directory where you "installed" eclipse
  • Open the file "eclipse.ini" (preferrably with some editor that shows the linebreaks)
  • Insert the line "-Duser.language=en_US" at the end of the file

and voila your eclipse should be in english language and all Locales will be in english!


If you don't want to change the language of your eclipse or this doesn't work for some reason you can always apply the Locale you're working in manually:

Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat ("E M y 'at' hh:mm:ss", Locale.ENGLISH);
System.out.println(ft.format(dNow));
ParkerHalo
  • 4,341
  • 9
  • 29
  • 51