Reputation: 923
Currently, we are getting stream of data from message queue, which contains multiple information. One of which is created and updated timestamp of a certain event in epoch format.
{"ip":"1.1.1.1","name":"abc.com","createtime":1500389719832,"updatetime":1500613413164 },{"ip":"1.1.1.2","name":"xyz.com","createtime":1500389719821,"updatetime":1500613413233}
Currently, my code will consume messages from queue and pushes all data to Neo4j as bulk. There would be 1000's of rows like this. Each field in this data is stored in neo4j as individual property keys. When a user selects a date from UI, my intention here is to get all the "name" values from that specific date and display only those records in the UI. As the user would select the date which would be in MM/DD/YYYY format, whats the best option to only compare the user selected date with "createtime" thats in epoch format? My thinking is to convert the "createtime" into MM/DD/YYYY readable format and store only the date portion as a separate neo4j property maybe newCreateTime, but i am not sure how to convert only the createtime and updatetime from entire stream of data. Can someone throw some light on this?
Upvotes: 3
Views: 5993
Reputation: 67019
You can use the APOC function apoc.date.format to set the newCreateTime
properties.
For example (assuming your data is stored in nodes with the Info
label):
MATCH (i:Info)
SET i.newCreateTime = apoc.date.format(i.createTime, 'ms', 'MM/dd/yyyy');
Upvotes: 4