-
Notifications
You must be signed in to change notification settings - Fork 17
Localtime is assumed to be UTC.. #37
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
Comments
Have you tried "2: think about running your Node.js process with TZ=UTC node ... to run in UTC timezone. q doesn't know timezones." ? |
Yes I tried using TZ=UTC as well.The result is no different. I changed operating system and found that this error is only with Window 10 version, but other linux based OS it works perfectly fine. |
I'm new to this project. (still have zero programming experience on node-q). It seems you want node-q or q to recognize datetime string smartly. But I think according to ISO8901, the string I hope this clue can help you to find whether the problem is in node-q or in q. |
@gullyy maybe you can share some code to demonstrate how you use the library to help you with this issue? |
I tried to paste the code here,but the formatting really sucks ,therefore create the following gist. |
In your example, the first datetime is |
In your example, the first datetime is 2017.12.19T11:56:02.544. Is this in UTC time? If you look at the table using the q client, what do you see? also 2017.12.19T11:56:02.544 ? If you retrieve the data with the nakedTableRead function, what do you get? 2017.12.19T11:56:02.544 ? Do you run node with TZ=UTC?
but it doesnt change anything._ |
I guess the problem is the following: when you insert the data, you use a string which means that node-q does no parsing at all. the string is just transfered to q where it is interpreted as an UTC datetime. no conversion happens at all. But your datetime string is actually not in UTC. So the timestamp that q stored will be kind of wrong. When you view the data with the q client, you will see the datetime as inserted, because q just displays the timestamp in UTC datetime format. When you get the data back, Node.js converts the timestamp into a Date object. The timestamp in q is 2017.12.19T11:56:02.544 UTC and then Node.js converts it into your local timezone and windows / Node.js for windows does not care about the TZ env variable, e.g. nodejs/node#4230. That's why you end up with a wrong time. 1.I would change the input to UTC datetimes or Let me know if this works. |
Yes the options mentioned by you works..right now I am doing an extra parsing-substracting the minutes from the value received from the db. One question. In your option 1 |
you can do something like this (untested):
|
Great I will use this. Thanks a ton! Closing the issue |
First of all I am based in 'Asia/Kolkata' timezone which is +530 from UTC
The value which I input in the DB looks like this -> 2017.12.24T21:32:59.103 317.5 . -> this is the localtime
When I query this value from the kdb console I get the above value back, which is correct.
However when I try to use this node adapter I get -> 2017.12-25 02:56:59.770.
The difference is exactly +530 from the local time.
When I use nodejs to get the local time it gives the right output. So my best guess is during transformation the timezone value is changed here
The text was updated successfully, but these errors were encountered: