I'm having trouble with a complex corporate web application which has been deployed in a French branch and now has to be deployed also in a German branch of the company. The problem has to do with the different behaviour of DateFormat based on the locale of the server:
The Date for United States:
In FULL is Tuesday, January 16, 2007
In LONG is January 16, 2007
In MEDIUM is Jan 16, 2007
In SHORT is 1/16/07
The Date for United Kingdom:
In FULL is 16 January 2007
In LONG is 16 January 2007
In MEDIUM is 16-Jan-2007
In SHORT is 16/01/07
The Date for Germany:
In FULL is Dienstag, 16. Januar 2007
In LONG is 16. Januar 2007
In MEDIUM is 16.01.2007
In SHORT is 16.01.07
The Date for France:
In FULL is mardi 16 janvier 2007
In LONG is 16 janvier 2007
In MEDIUM is 16 janv. 2007
In SHORT is 16/01/07
Now the application makes extensive use of:
brch.setDate(DateFormat.getDateInstance(DateFormat.SHORT).parse("02/04/2013"));
the above seems to work in France and the UK, however when it is deployed in Germany all hell breaks loose and we receive tons of errors. Now I know we can specify the Locale with a
DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK)
however changing the code for the whole application would require days and a lot of testing, is there a way to specify globally the default locale for this application? Or some way to make the applicaion Locale-agnostic without changing too much the application?
Thank you