Reputation: 33
I have some graph data with date type values. My gremlin query for the date type property is working, but output value is not the date value.
Environment:
Below is my example:
{"ID": "doc_1", "MY_DATE": [Tue Jan 10 00:00:00 KST 1079]}
g.V().has("ID", "doc_1").valueMap("MY_DATE")
datetime(1079, 1, 16)
The error is 6 days (1079.1.10 -> 1079.1.16). This mismatch does not occur when the years are above 1600. Does the timestamp have some serialization/deserialization problems between janusgraph and gremlinpython?
Thanks
Upvotes: 1
Views: 575
Reputation: 33
After some try & search, I found that there are some difference between java Date and python datetime. (Julian vs. Gregorian Calendar) So I have replaced SimpleDateFormat with JodaTime and got the expected result as below:
Thanks
Upvotes: 1
Reputation: 46226
There were some issue with Python and dates but I would have them fixed for 3.4.3, which is the version you stated you were using. The issue is described here at TINKERPOP-2264 along with the fix, but basically there were some issues with timezones. From your example data, it looks like you store your date with a timezone (i.e. KST). I'm not completely sure, but I would imagine things would work as expected if the date was stored as UTC.
Upvotes: 1