Skip to content

Displaying DATETIME values applies timezone offset #872

@aschnappauf

Description

@aschnappauf

It seems, dolt workbench applies the current timezone offset when/before displaying datetime values. This results in erroneous data being shown. According to Datetimes versus timestamps in MySQL, datetime columns should not be subject to any adjustments regarding timezones.

For me, the values in dolt-workbench are -02:00 from the actual values. My timezone is +02:00.

Example:

Console (dolt sql), correct

SELECT @@time_zone, now(), utc_timestamp();

+-------------+---------------------+----------------------------+
| @@time_zone | now()               | utc_timestamp()            |
+-------------+---------------------+----------------------------+
| SYSTEM      | 2026-04-16 12:03:20 | 2026-04-16 10:03:20.477400 |
+-------------+---------------------+----------------------------+

dolt workbench, incorrect

SELECT @@time_zone, now(), utc_timestamp();

+-------------+---------------------+----------------------------+
| @@time_zone | now()               | utc_timestamp()            |
+-------------+---------------------+----------------------------+
| SYSTEM      | 2026-04-16 10:04:44 | 2026-04-16 08:04:44        |
+-------------+---------------------+----------------------------+

This is also the case for stored datetimes:

CREATE TABLE foo(
  id INTEGER PRIMARY KEY,
  d DATETIME
);
INSERT INTO foo VALUES (1, now()), (2, utc_timestamp());

Console (dolt sql), correct

SELECT * FROM foo;

+----+---------------------+
| id | d                   |
+----+---------------------+
| 1  | 2026-04-16 11:57:22 |
| 2  | 2026-04-16 09:57:22 |
+----+---------------------+

Console (dolt sql), incorrect

SELECT * FROM foo;

+----+---------------------+
| id | d                   |
+----+---------------------+
| 1  | 2026-04-16 09:57:22 |
| 2  | 2026-04-16 07:57:22 |
+----+---------------------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions