Closed szs8 closed 8 years ago
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
It seems that np.datetime64 assumes UTC when KDB is showing a local timestamp. Any way to get around this?