United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6488119 en_ZA local has unusable time format
JDK-6488119 : en_ZA local has unusable time format

Details
Type:
Bug
Submit Date:
2006-10-31
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2008-02-14
Component:
globalization
OS:
windows_2003,solaris_2.5.1
Sub-Component:
translation
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.2,5.0
Fixed Versions:
6u10 (b12)

Related Reports
Backport:
Backport:
Duplicate:

Sub Tasks

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.
                                     
2006-11-01



Hardware and Software, Engineered to Work Together