Bug #98468 Timestamp retrieved from DATETIME column have to be corrected with 'GMT-6:00'
Submitted: 3 Feb 2020 15:34 Modified: 13 Feb 2020 13:59
Reporter: Ray Eldath Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:8.0.19 OS:Any
Assigned to: CPU Architecture:Any
Tags: datetime, docker, jdbc, timestamp

[3 Feb 2020 15:34] Ray Eldath
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.
[13 Feb 2020 13:59] Alexander Soklakov
Hi Ray,

This is a duplicate of Bug#93444.