Thanks to visit codestin.com
Credit goes to github.com

Skip to content

to_timezone() outputs wrong time zone designator (or wrong timestamp?) #2364

@salsasepp

Description

@salsasepp

Describe the bug

This UNIX timestamp (with microseconds)

1659078123000000

corresponds to this ISO datetime:

2022-07-29T07:02:03.000000Z

When converting to a different time zone using to_timezone(), the timestamp string is "almost" correct, but has a Z timezone designator, which is wrong.

To reproduce

SELECT to_timezone(1659078123000000, 'Europe/Berlin');

outputs

2022-07-29T09:02:03.000000Z

Expected Behavior

Either a local time (no time zone designator)

2022-07-29T09:02:03.000000

or a timestamp with UTC offset

2022-07-29T09:02:03.000000+02:00

Alternatively, in case to_timezone() is expected to output UTC (which I would find confusing, given the description of the function):

2022-07-29T07:02:03.000000Z

Environment

- **QuestDB version**: 6.4.3 (binaries)
- **OS**: Linux desktop 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Additional context

See also #2363

Metadata

Metadata

Assignees

No one assigned

    Labels

    SQLIssues or changes relating to SQL executionhacktoberfestA good issue for Hacktoberfest 2025 contributors. No AI-driven commits, please

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions