Skip to content

The use of local timezone in DateTime conversion is inconsistent with CLI client #1492

Open
@larry-cdn77

Description

@larry-cdn77

DateTime parsing defaults to using client zone (time.Local)

return getTimeWithDifferentLocation(tv, time.Local), nil

I believe this was introduced in 0704ee8 ('align date and datetime handling with spec'); maybe earlier as #291 before that had mentioned 'it's better to use local timezone than UTC'

CLI client defaults to server timezone unless you specify --use_client_time_zone=true, for example:

clickhouse client -h server.local -q "INSERT INTO a VALUES ('2025-02-07 00:00:00')"
TZ=CET clickhouse client -h server.local -q "INSERT INTO a VALUES ('2025-02-07 00:00:00')" --use_client_time_zone=true
clickhouse client -h server.local -q "SELECT * FROM a"

gets me only the second timestamp shifted into the CET timezone

Should the library match the CLI?

What is the specification mentioned in 0704ee8, maybe that would help explain the motivation?

Or is it issue #135 which resulted in PR #291?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions