title: Why does java.text.DateFormat return the same date format for en_US and en_GB on Android?
body: <p>I have a small Android application which I'm using to print a specific date in different formats based on locale.</p>
  
  <p>Here is my code (using <code>java.text.DateFormat</code>):</p>
  
  <pre><code>Locale[] locales = {new Locale("en", "US"), new Locale("en", "GB"), new Locale("en", "AU"), new Locale("en", "NZ"), new Locale("en", "ZA")};
  for(int i = 0; i &lt; locales.length; ++i) {
      Log.d(logKey, locales[i].toString() + " - " + DateFormat.getDateInstance(DateFormat.SHORT, locales[i]).format(Calendar.getInstance().getTime()));
  }
  </code></pre>
  
  <p>The output from this in LogCat is thus:</p>
  
  <pre><code>D/FormatPoC(  390): en_US - 4/27/12
  D/FormatPoC(  390): en_GB - 4/27/12
  D/FormatPoC(  390): en_AU - 4/27/12
  D/FormatPoC(  390): en_NZ - 4/27/12
  D/FormatPoC(  390): en_ZA - 4/27/12
  </code></pre>
  
  <p>So my question is - why are all of these the same? In Java SE I get:</p>
  
  <pre><code>en_US - 4/27/12
  en_GB - 27/04/12
  en_AU - 27/04/12
  en_NZ - 27/04/12
  en_ZA - 2012/04/27
  </code></pre>
  
  <p>Which is what I would expect. I know that I can use <code>android.text.format.DateFormat</code> to get correct results based on the user's current locale and date order setting, but that doesn't explain why using <code>java.text.DateFormat</code> to get the format for a programmatically specified locale doesn't return the right results.</p>
  
  <p>Additionally, it's not just the <code>SHORT</code> date format - <code>MEDIUM</code> and <code>LONG</code> show inconsistencies between Android and Java SE as well (i.e. Android returns the same format for all 5 Locales I specified).</p>
  
  <p>I've tested it on 3 different devices (2.3 and 4.0) and on the emulator (2.3 and 4.0), all with the same results. I've also tested using <code>Locale.US</code> and <code>Locale.UK</code> just to see if they're somehow different, but the results are the same.</p>
  
  <p>Has anyone else run into this, or know why this would be?</p>
  
  <p><strong>UPDATE: 2012-07-18</strong></p>
  
  <p>It appears that this is an issue with the emulator, as well as many devices manufactured in the US. Using Dalvik Explorer:</p>
  
  <p><a href="https://play.google.com/store/apps/details?id=org.jessies.dalvikexplorer&amp;hl=en" rel="nofollow">https://play.google.com/store/apps/details?id=org.jessies.dalvikexplorer&amp;hl=en</a> </p>
  
  <p>I've been able to see what the system returns for en_GB on different devices (including the emulator). Some return the appropriate formats, some return the en_US format. I assume this is simply an issue of what format resources are built into the OS for each device, though being that the <em>emulator</em> returns the wrong formats as well as many of my US-manufactured devices, I wonder what British developers think, or if they've seen this problem.</p>