Skip to content

Timezone issues #29

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

Closed
szs8 opened this issue Aug 25, 2015 · 1 comment
Closed

Timezone issues #29

szs8 opened this issue Aug 25, 2015 · 1 comment
Labels

Comments

@szs8
Copy link

szs8 commented Aug 25, 2015

It seems that np.datetime64 assumes UTC when KDB is showing a local timestamp. Any way to get around this?

In [67]: conn.sync("string .z.Z")
Out[67]: '2015.08.25T18:03:28.368'

In [69]: print conn.sync(".z.Z")
2015-08-25T14:03:36.137-0400 [metadata(qtype=-15)]
@maciejlach
Copy link
Collaborator

The IPC protocol doesn't provide timezone information while transferring datetime objects. E.g. datetime is represented as a float value under the hood:

q).z.Z
2015.08.27T11:22:34.759
q)9h$.z.Z
5717.474

While creating np.datetime64 objects, qPython is not aware of timezone connected with datetime. Moreover, timezone handling in numpy is not perfect.

You could call .item() on a np.datetime64 object to get a naive datetime object that represents time in UTC:

>>> dt = q('.z.Z')
>>> print dt.raw
2015-08-27T13:26:44.963+0200
>>> print dt.raw.item()
2015-08-27 11:26:44.963000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants