JDK-5096553 : REGRESSION: SimpleDateFormat not working with Locale
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-03
  • Updated: 2005-03-22
  • Resolved: 2005-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.
JDK 6
6 b24Fixed
Related Reports
Relates :  
Description
Name: rmT116609			Date: 09/02/2004


FULL PRODUCT VERSION :
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
When using a danish Locale a SimpledateFormat.format should return the date in dd-mm-yy but returns the date in yy-mm-dd

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Locale.setDefault(new Locale("da"));
SimpleDateFormat sdf = new SimpleDateFormat();
System.out.println(sdf.format(new Date()));


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
in 1.4.2 it returns
02-09-04 15:45

in 5.0 it returns
04-09-02 15:45
ACTUAL -
04-09-02 15:45

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/
public class DateTest {

	public static void main(String[] args) {
		Locale.setDefault(new Locale("da"));
		SimpleDateFormat sdf = new SimpleDateFormat();
		System.out.println(sdf.format(new Date()));

	}
}
---------- END SOURCE ----------

Release Regression From : 1.4.2_04
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Incident Review ID: 301698) 
======================================================================
###@###.### 10/12/04 08:48 GMT

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
15-09-2004

EVALUATION The date formats for MEDIUM and SMALL were changed as the 4842276 fix. Transferring to the L10N team. ###@###.### 2004-09-03 ###@###.###, please work with locale data owner to evaluate this bug. ###@###.### 2004-09-03 i am going to commit this bug to mustang to get it off tiger EC list. ###@###.### 2004-09-07 There are many different formats mentioned in this and referred bug. Using following resources: http://oss.software.ibm.com/cvs/icu/~checkout~/locale/common/main/da.xml http://www.microsoft.com/globaldev/nlsweb/default.asp?submitted=406 let the SHORT : "dd-MM-yy" MEDIUM : "dd-MM-yyyy" leave others untouched. ###@###.### 10/12/04 08:48 GMT The reply from Retsskrivningsordbogen folks: "Following the international convention the order will be year - month - day, e.g. 04-10-15. The Danish convention is the opposite: day - month - year, e.g. 15-10-04." For full reply see attachement. This confirmes previous evaluation. As we cannot support two different formats in one locale the "da" and "da_DK" will use Danish convention. If for some reason somebody will need to have international format he has to use Locale.ENGLISH. ###@###.### 10/15/04 07:51 GMT
15-10-0004