Presto JDBC: Timezone displays incurrect even after setting -Duser.timezone=+0800
Answered
Current time is `2018-11-27 14:52:11` timezone=+0800
But
1. `select now()` is `2018-11-27 06:52:11` (Wrong)
2.
```sql
-- result: 2018-11-27 00:00:07, 2018-11-27 06:52:37 (Wrong)
select
min(sale_time),
max(sale_time)
from sales
where sale_time > current_date and sale_time <= now()
```
After setting VM options to `-Duser.timezone=+0800`
1. `select now()` is `2018-11-27 06:52:11` (Wrong)
2.
```sql
-- result: 2018-11-27 00:00:07, 2018-11-27 14:52:57 (Right)
select
min(sale_time),
max(sale_time)
from sales
where sale_time > current_date and sale_time <= now()
```
Any solutions?
Better view:
Please sign in to leave a comment.
Could you specify your presto db jdbc driver version?
It's 0.213, same issue using 0.211, 0.214. I think it's not about the jdbc version. Please check this out:
It works if use Java code (VM options: -Duser.timezone=+0800)
I reproduced the issue. Follow https://youtrack.jetbrains.com/issue/DBE-7504 to get updates
using the 2021.2 RC this does not appear to be fixed by DBE-7504
Alexga,
Everything is working as expected in 2021.2 RC.
Output of Presto CLI:
Output of DataGrip 2021.2 RC:
Could you provide an example to reproduce your issue?
Appreciate the follow up. Apologize for not adding an example in the first place.
I'm running 2021.2 (no longer the RC) at this point but am still able to recreate.
output from CLI:
Output from DataGrip 2021.2:
Alexga,
I see. Could you leave a comment in https://youtrack.jetbrains.com/issue/DBE-7504 and attach IDE and SQL logs for investigation?
vasily chernov, I see you copied the above over, do you need server logs as well? happy to provide them if needed
Alexga, it would be great if you provide exact server version, server timezone, your client timezone and JDBC driver version. Could you do that?
current version:
server timezone:
and
client timezone:
no vm options
jdbc driver:
This is the provided driver, but I've also tried it with ver 359
It seems Datagrip 2023.2.1 bring this bug back.
Trino Server: 420
JDBC: 407
DataGrip 2022.3.3 works as expected.
Can I ask you to report it?
https://youtrack.jetbrains.com/newIssue?project=DBE
Bear0king
I have reproduced the part where the timezone was truncated from the output when running 'select current_timestamp', but I could not spot any issues with the time returned by the current_timezone() function. I have this issue reported here, so feel free to add your examples there, and we'll sum it up