Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change DBeaver timezone / How to stop DBeaver from converting date and time

When I use DBeaver with Cassandra, it shows an offset of +01:00 even though the data is stored in Date or Times formats, that don't have any timezones. This results in some weird queries like this:

SELECT "Time"
FROM keyspace."Table"
ORDER BY "Time" DESC;

Time
00:00:00
23:00:00
22:00:00
...
01:00:00

So, how do I remove the conversions or do I set the timezone to UTC?

like image 857
Edu Avatar asked Jul 26 '17 09:07

Edu


3 Answers

I found another solution:

Setting dbeaver.ini file in DBeaver root directory.

Open the file:

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-showsplash
# START: change jre version, not using the one in %JAVA_HOME%
-vm 
D:\ArPortable\Java\jdk1.8.0_171\jre\bin\server\jvm.dll
# END
# JVM settings
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
-Xms64m
-Xmx1024m
# time zone
-Duser.timezone=UTC
# language
-Duser.language=en
like image 186
Archon Avatar answered Oct 22 '22 03:10

Archon


DBeaver uses the time in the computer that is installed, so changing the clock and restarting DBeaver works. But there is a way to do it only for DBeaver instead.

  • Close DBeaver.
  • Go to the DBeaver shortcut. Probably it is here:

    C:\ProgramData\Microsoft\Windows\Start Menu\Programs\DBeaver

  • Right-click on it, choose Properties and in the Target box add -vmargs -Duser.timezone=UTC to the end, resulting in something like this:

    "C:\Program Files\DBeaver\dbeaver.exe" -vmargs -Duser.timezone=UTC

  • Start DBeaver and the times now appear in UTC.

like image 21
Edu Avatar answered Oct 22 '22 04:10

Edu


v22.1.0 added this preference in the UI (no more modifying .ini files).

In Window -> Preferences. Go to User Interface and change the Client Timezone. Restart dbeaver.

Github PR here: https://github.com/dbeaver/dbeaver/pull/16467

enter image description here

like image 17
Gabe Avatar answered Oct 22 '22 04:10

Gabe