ClickHouse stores DateTime as Unix timestamp - other words without timezone.
But timezone is taken into account when sql-query executed:
SELECT
toDateTime('2019-08-31 20:35:00', 'UTC') AS origin_date,
toTimeZone(origin_date, 'Etc/GMT+2') AS d1,
toTypeName(d1) AS type1,
toUnixTimestamp(d1) AS t1,
toTimeZone(origin_date, 'UTC') AS d2,
toTypeName(d2) AS type2,
toUnixTimestamp(d2) AS t2
FORMAT Vertical
Row 1:
──────
origin_date: 2019-08-31 20:35:00
d1: 2019-08-31 18:35:00
type1: DateTime('Etc/GMT+2')
t1: 1567283700 # <-- t1 == t2
d2: 2019-08-31 20:35:00
type2: DateTime('UTC')
t2: 1567283700 # <-- t1 == t2
Your query works correctly.
To 'reset the timezone' of z-date can be used this way:
SELECT toDateTime(toString(toTimeZone(ts, 'Etc/GMT+2'))) AS z
FROM
(
SELECT toDateTime('2019-08-31 20:35:00') AS ts
)
WHERE z > '2019-08-31 20:34:00'