Skip to content

Feature: Preserve timezone information in timestamp #5190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NatanPuzis opened this issue Apr 3, 2025 · 2 comments
Open

Feature: Preserve timezone information in timestamp #5190

NatanPuzis opened this issue Apr 3, 2025 · 2 comments
Labels
feature New features or missing components of existing features

Comments

@NatanPuzis
Copy link

API

Python

Description

As I understand, there is no way to preserve timezone information with TIMESTAMP.
Seems like a convenient feature to have.

@NatanPuzis NatanPuzis added the feature New features or missing components of existing features label Apr 3, 2025
@prrao87 prrao87 changed the title Feature: Feature: Preserve timezone information in timestamp Apr 3, 2025
@prrao87
Copy link
Member

prrao87 commented Apr 3, 2025

Hi @NatanPuzis , do you mean something like how Python saves the Z string at the end of the timestamp to indicate it's in UTC?

@NatanPuzis
Copy link
Author

If we take Python as an example:

from datetime import datetime

ts_from_log = '2020-02-03T19:43:01.572071+04:00'
dt = datetime.fromisoformat(ts_from_log)
# time offset preserved
print(dt)

epoch = dt.timestamp()
# time offset lost
ts = datetime.fromtimestamp(epoch)
print(ts)

output:

2020-02-03 19:43:01.572071+04:00
2020-02-03 17:43:01.572071

As you can see, datetime objects can preserve time offset. By contrast, when using epoch/epoch_ms we loose this info. The usual work-around is keeping this info as an adjacent attribute, which is less convenient.

This is very useful piece of information in many cases, most prominent probably is calculation of daylight saving times - without time offset it is only a guess work.

On the other side, as I understand, most popular RDBMs do not offer this capability. I assume, Kuzu just followed the suit.

Up to you guys to consider whether it is worth the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features or missing components of existing features
Projects
None yet
Development

No branches or pull requests

2 participants