-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8u131
-
x86_64
-
linux
FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux Vortex 4.10.0-24-generic #28~16.04.1-Ubuntu SMP Wed Jun 14 11:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Conversion from a string to a ZonedDateTime results in incorrect transformation on daylight savings:
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
ZonedDateTime.parse(faulty_datetime).toString() leads to "2017-10-29T02:15+02:00[Europe/Rome]"
Please note the change of timezone
ZonedDateTime.parse(faulty_datetime).plusHours(1).toString() leads to "2017-10-29T02:15+01:00[Europe/Rome]" that is the requested input date, requires a plus 1 hour
Parsing the string "2017-10-29T02:15+01:00[Europe/Rome]" creates a date 1hr in the past
Please note that all the strings in these examples has been created by actual toString() of ZonedDateTime objects
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply try converting to/from the specified datetime
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting to obtain the time i specified in the parsed string, otherwise exchanging dates through strings (on a DB for instance) would be impossible in daylight savings times using java output. My current issue is that after saving a date as a string, when converted back to java object it overlaps with other dates due to the conversion problem
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
ZonedDateTime.parse(faulty_datetime).toString() should lead to "2017-10-29T02:15+01:00[Europe/Rome]"
ACTUAL -
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
ZonedDateTime.parse(faulty_datetime).toString() leads to "2017-10-29T02:15+02:00[Europe/Rome]"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.time.ZonedDateTime;
public class ClientSimulator {
public static void main(String[] args) throws Exception {
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
System.err.println(ZonedDateTime.parse(faulty_datetime).toString().equals(faulty_datetime));
}
}
---------- END SOURCE ----------
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux Vortex 4.10.0-24-generic #28~16.04.1-Ubuntu SMP Wed Jun 14 11:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Conversion from a string to a ZonedDateTime results in incorrect transformation on daylight savings:
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
ZonedDateTime.parse(faulty_datetime).toString() leads to "2017-10-29T02:15+02:00[Europe/Rome]"
Please note the change of timezone
ZonedDateTime.parse(faulty_datetime).plusHours(1).toString() leads to "2017-10-29T02:15+01:00[Europe/Rome]" that is the requested input date, requires a plus 1 hour
Parsing the string "2017-10-29T02:15+01:00[Europe/Rome]" creates a date 1hr in the past
Please note that all the strings in these examples has been created by actual toString() of ZonedDateTime objects
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply try converting to/from the specified datetime
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I was expecting to obtain the time i specified in the parsed string, otherwise exchanging dates through strings (on a DB for instance) would be impossible in daylight savings times using java output. My current issue is that after saving a date as a string, when converted back to java object it overlaps with other dates due to the conversion problem
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
ZonedDateTime.parse(faulty_datetime).toString() should lead to "2017-10-29T02:15+01:00[Europe/Rome]"
ACTUAL -
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
ZonedDateTime.parse(faulty_datetime).toString() leads to "2017-10-29T02:15+02:00[Europe/Rome]"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.time.ZonedDateTime;
public class ClientSimulator {
public static void main(String[] args) throws Exception {
String faulty_datetime = "2017-10-29T02:15+01:00[Europe/Rome]";
System.err.println(ZonedDateTime.parse(faulty_datetime).toString().equals(faulty_datetime));
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8066982 ZonedDateTime.parse() returns wrong ZoneOffset around DST fall transition
-
- Resolved
-