Take the 2-minute tour ×

Basicaly I want to format a Date object using a specific pattern and the output should be in English. How can I prevent java from translating the output in the system language?

String date = new SimpleDateFormat("EEE MMM dd kk:mm:ss yyyy").format(myDate);
// output is in German:
// Mi Aug 26 16:35:55 2009
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

SimpleDateFormat is always localized, it makes no sense otherwise.

You can, however, specify the Locale to use when you build it, e.g.

SimpleDateFormat format = new SimpleDateFormat(
   "EEE MMM dd kk:mm:ss yyyy", 
share|improve this answer
Thanks! I have to pass a timestamp to a remote server, that's why I needed "unlocalized" output. –  stefita Aug 26 '09 at 14:50
In that case, I suggest passing in ISO-standard format. JodaTime's ISODateTimeFormat performs that task nicely. –  skaffman Aug 26 '09 at 14:51
add comment

Your Answer


