JDK-6488119 : en_ZA local has unusable time format
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 1.4.2,5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_2.5.1,windows_2003
  • CPU: x86
  • Submitted: 2006-10-31
  • Updated: 2011-02-16
  • Resolved: 2008-02-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
5.0u12Fixed 6u10 b12Fixed 7Fixed
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
1.5.0.8

ADDITIONAL OS VERSION INFORMATION :
Not OS specific

A DESCRIPTION OF THE PROBLEM :
The local for en_ZA has an unusable medium time format, a 12 hour clock without am or pm. The timezone should be included or the clock should be changed to a 24 hour clock

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Below is some simple code to display the date formats for a specific locale. Simply call it with 2 parameters( java TestLocal en ZA) you will see (if you do this in the afternoon :-) That the local uses a 12hour clock with no AM/PM

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.util.Locale;
import java.util.Date;
import java.text.DateFormat;
class TestLocale
{
    public static final void main(String[] args)
    {

	Locale locale = new Locale(args[0],args[1]);
	System.out.println("got locale for "+ locale.getDisplayLanguage()+" " +
locale.getDisplayCountry());

	DateFormat dl = DateFormat.getDateInstance(DateFormat.LONG, locale);
	System.out.println("Long date is "+ dl.format(new Date()));
	
	DateFormat tl = DateFormat.getTimeInstance(DateFormat.LONG, locale);
	System.out.println("Long time is "+ tl.format(new Date()));


	DateFormat dm = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
	System.out.println("MEDIUM date is " + dm.format(new Date()));

	DateFormat tm = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
	System.out.println("Medium time is "+ tm.format(new Date()));

	DateFormat ds = DateFormat.getDateInstance(DateFormat.SHORT, locale);
	System.out.println("SHORT date is "+ ds.format(new Date()));

	DateFormat ts = DateFormat.getTimeInstance(DateFormat.SHORT, locale);
	System.out.println("Short time is "+ ts.format(new Date()));
    }
}
---------- END SOURCE ----------

Comments
EVALUATION Verified with CLDR and the submitters suggestion to add a am/pm field is consistent with it. Fix: j2se:src/share/classes/sun/text/resources/FormatData_en_ZA.java add the "a" letter to the long, medium and short time format to have: "h:mm:ss a" - long "h:mm:ss a" - medium "h:mm a" - short Backporting the fix from v7.
01-11-2006