I just found the static getAvailableLocales method in Locale, and it turns out that all calendar fields can be locale dependent:
public static void main(String[] args) { String pattern = "yyyy-MM-dd HH:mm:ss"; Date date = new Date(); String defaultFmt = new SimpleDateFormat(pattern).format(date); for (Locale locale : Locale.getAvailableLocales()) { String localeFmt = new SimpleDateFormat(pattern, locale).format(date); if (!localeFmt.equals(defaultFmt)) { System.out.println(locale + " " + localeFmt); } } }
On my system (in Germany, the English version of ubuntu is running), this displays the following list, it is hoped that the unicode character will fall into the intact:
ja_JP_JP 23-03-03 16:53:09 hi_IN २०११-०३-०३ १६:५३:०९ th_TH 2554-03-03 16:53:09 th_TH_TH ๒๕๕๔-๐๓-๐๓ ๑๖:๕๓:๐๙
So Japan and Thailand use a different era, but otherwise based on, which explains why the month and day coincide.
Other locales also use different scripts to record numbers, such as the Hindi that are spoken in India and the Thai language variant in Thailand.
To answer the question, the locale should always be given to a known value when a String independent string is needed.
Edit: Java 1.6 added the Locale.ROOT constant to indicate the language / country of a neutral locale. It would be preferable to specify English for computer-oriented output.
A root language is a language, a language whose country and variant are empty ("") strings. This is considered as the basic localization of all locales and is used as a language neutral language standard for language operations.
Jörn horstmann
source share