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

Viewed 57717

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?

9 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

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

UPDATE 2021-04-05: Based on recent comments I need to clear that this solution suitable only for Clickhouse DB. Additionally it is very old answer, please, take in mind that it is currently 99% outdated solution.

I think it was fixed in some previous release.

Just go to Settings -> Editors -> Data Formats and select 'Use native date/time format' checkbox.

enter image description here

On Mac

  1. Go to Finder > Applications
  2. Right click on DBeaver and select Show Package Contents
  3. Open Contents\Eclipse\dbeaver.ini
  4. After the -vmargs line, add this: -Duser.timezone=UTC
  5. Save file and restart DBeaver

Limitation: You’ll have to redo this for every version upgrade.

Windows

  1. Go to DBeaver install directory C:\Program Files\DBeaver
  2. Open dbeaver.ini
  3. After the -vmargs line, add this: -Duser.timezone=UTC
  4. Save file and restart DBeaver

Source: This blog

If you wanna see the TimeZone of your Selects, you can go to DBeaver Preferences:

Preferences enter image description here

  1. Click on Type, and change it to Timestamp
  2. In Pattern Value add the termination " Z z" and see the Sample result like this: 2019-11-06 07:38:54 -0300 BRT
  3. Tap Apply, and Apply and Close
  4. Done :)

For DBeaver in Linux

  1. Quit DBeaver if it's running.

  2. Edit /usr/share/dbeaver/dbeaver.ini, adding -Duser.timezone=UTC to -vmargs section. E.g.:

     -vmargs
     -XX:+IgnoreUnrecognizedVMOptions
     --add-modules=ALL-SYSTEM
     -Dosgi.requiredJavaVersion=11
     -Xms64m
     -Xmx1024m
     -Duser.timezone=UTC
    
  3. Open DBeaver and view timestamps in UTC.

Viewing full timestamp values

  1. Window > Preferences
  2. Editors > Data Editor > Data Formats
  3. Check 'Disable date/time formatting'

Before: 2021-04-19 16:14:23

After: 2021-04-19 16:14:23.056178+00

Tested with PostgreSQL.

If this is the JDBC driver issue with regards to the timezone:
Right click on the connection to open connection settings

right click on the connection to open connection settings

change the timezone change the timezone for the connection

OR you may also change the server timezone driver property OR you may change the server timezone driver property

As of today (DBeaver 21.3.2 CE) you need to go to Window > Preferences. In the dialog pop-up window choose: Editors > Data Editor > Formats, then choose Timestamp in the dropdown in the Format frame and click on Timesone line.

enter image description here

Right-click there and print UTC

enter image description here

Click the 'Apply and Close' button in the lower right corner. Done!

Related