ADDITIONAL SYSTEM INFORMATION :
OS: MacOs/Linux
Java: 1.8/11
A DESCRIPTION OF THE PROBLEM :
// for both java 8 and 11 I can see the following code snippet add 1 hour to the Timestamp
Timezone Pacific Standard Time (PST)
public class TestSQLTimstampParser {
public static void main(String[] args) {
//2019-03-10 02:46:18.792035
java.sql.Timestamp ts = Timestamp.valueOf("2019-03-10 02:46:18.792035");
java.sql.Timestamp ts1 = Timestamp.valueOf("2019-03-10 02:46:18");
System.out.println(ts); // 2019-03-10 03:46:18.792035
System.out.println(ts1);
// 2019-08-13 04:51:43
java.sql.Timestamp ts2 = Timestamp.valueOf("2019-08-13 04:51:43");
System.out.println(ts2); // output 2019-08-13 04:51:43.0
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public class TestSQLTimstampParser {
public static void main(String[] args) {
//2019-03-10 02:46:18.792035
java.sql.Timestamp ts = Timestamp.valueOf("2019-03-10 02:46:18.792035");
java.sql.Timestamp ts1 = Timestamp.valueOf("2019-03-10 02:46:18");
System.out.println(ts); // 2019-03-10 03:46:18.792035
System.out.println(ts1);
// 2019-08-13 04:51:43
java.sql.Timestamp ts2 = Timestamp.valueOf("2019-08-13 04:51:43");
System.out.println(ts2); // output 2019-08-13 04:51:43.0
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
2019-03-10 02:46:18.792035
2019-03-10 02:46:18.0
2019-08-13 04:51:43.0
ACTUAL -
2019-03-10 03:46:18.792035
2019-03-10 03:46:18.0
2019-08-13 04:51:43.0
FREQUENCY : always
OS: MacOs/Linux
Java: 1.8/11
A DESCRIPTION OF THE PROBLEM :
// for both java 8 and 11 I can see the following code snippet add 1 hour to the Timestamp
Timezone Pacific Standard Time (PST)
public class TestSQLTimstampParser {
public static void main(String[] args) {
//2019-03-10 02:46:18.792035
java.sql.Timestamp ts = Timestamp.valueOf("2019-03-10 02:46:18.792035");
java.sql.Timestamp ts1 = Timestamp.valueOf("2019-03-10 02:46:18");
System.out.println(ts); // 2019-03-10 03:46:18.792035
System.out.println(ts1);
// 2019-08-13 04:51:43
java.sql.Timestamp ts2 = Timestamp.valueOf("2019-08-13 04:51:43");
System.out.println(ts2); // output 2019-08-13 04:51:43.0
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public class TestSQLTimstampParser {
public static void main(String[] args) {
//2019-03-10 02:46:18.792035
java.sql.Timestamp ts = Timestamp.valueOf("2019-03-10 02:46:18.792035");
java.sql.Timestamp ts1 = Timestamp.valueOf("2019-03-10 02:46:18");
System.out.println(ts); // 2019-03-10 03:46:18.792035
System.out.println(ts1);
// 2019-08-13 04:51:43
java.sql.Timestamp ts2 = Timestamp.valueOf("2019-08-13 04:51:43");
System.out.println(ts2); // output 2019-08-13 04:51:43.0
}
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
2019-03-10 02:46:18.792035
2019-03-10 02:46:18.0
2019-08-13 04:51:43.0
ACTUAL -
2019-03-10 03:46:18.792035
2019-03-10 03:46:18.0
2019-08-13 04:51:43.0
FREQUENCY : always
- relates to
-
JDK-8262909 Timestamp.valueOf() adds one hour to the timestamp for DST
- Closed