Description:
On Docker for Windows, image mysql:latest(8.0.19) and Connector / J (mysql:mysql-connector-java:8.0.19), retrieved a java.sql.Timestamp from a DATETIME typed column returns incorrect result.
Correct result from mysql CLI:
+---------------------+
| dt |
+---------------------+
| 2020-02-03 21:00:00 |
+---------------------+
1 row in set (0.00 sec)
Result resulted from the following code:
2020-02-04 11:00:00.0
How to repeat:
On described environment (TZ environment variable of Docker image has been set to my local timezone), run following code:
```kotlin
Class.forName("com.mysql.cj.jdbc.Driver")
val conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/database", "test", "1234")
val stat = conn.createStatement()
stat.execute("create table test (dt timestamp null)")
stat.execute("insert into test values ('2020-02-03 21:00:00')")
stat.executeQuery("select * from test")
.let {
it.next()
println(it.getTimestamp("dt"))
}
```
you'll get 2020-02-04 11:00:00.0 instead of 2020-02-03 21:00:00.
note that the wrong result is neither in my current timezone, nor UTC. you have to corrected the result by run following code beforehand:
```
TimeZone.setDefault(TimeZone.getTimeZone("GMT-6:00"))
```
this affects all Local* as well.