Name: jl125535 Date: 04/09/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Windows TimeZone = "(GMT+10:00) Canberra, Melbourne, Sydney"
Automatically adjust for daylight saving checkbox selected.
A DESCRIPTION OF THE PROBLEM :
When using a SimpleDateFormat with a pattern of "yyyy.MM.dd
G HH:mm:ss.SSS z" to parse a String of format "2003.01.13 AD
11:10:00.802 EST" SimpleDateFormat.parse(String) returns an
incorrect Date.
The Time field is always one hour out.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Set the Windows Timezone to the Sydney Timezone.
2. Ensure the "Automatically adjust for daylight saving"
checkbox is selected.
3. Compile and run provided java source.
EXPECTED VERSUS ACTUAL BEHAVIOR :
What I'm expecting is the returned Date be the same as the
input Date/Time String, as both the input timezone (EST) and
the machines timezone are the some.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Date;
import java.text.SimpleDateFormat;
public class Test {
public static void main (String args[]) {
try {
String attr = "2003.01.13 AD 11:10:00.802 EST";
System.out.println("attr = " + attr);
String DATE_TIME_PATTERN = "yyyy.MM.dd G HH:mm:ss.SSS z";
SimpleDateFormat dfDeptDate =
new SimpleDateFormat(DATE_TIME_PATTERN);
Date parsedDate = dfDeptDate.parse(attr);
System.out.println("parsedDate = " + parsedDate);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("done.");
System.exit(0);
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
De-selecting the "Automatically adjust for daylight saving"
checkbox on the Windows Timezone dialog.
(Review ID: 179963)
======================================================================
- relates to
-
JDK-4312621 (cal) API: DST transition handling is ambiguous in GregorianCalendar
-
- Open
-
-
JDK-4705403 API: DateFormat Should Supply Time Zone of Parsed Date
-
- Open
-
-
JDK-6609675 [Fmt-Da] DateFormat.parse() on a timezone changes its calendar's timezone
-
- Resolved
-
-
JDK-6620374 [TEST] test/java/text/Format/Bug4845901.java failed when System timezone set to the East of America
-
- Closed
-