I'm new to neo4j and I need some help with the date and time formatting in neo4j.
I want a query in neo4j which shows date and time in given format '24-09-2019 17:40:33'.
Please let me know how can i achieve this in neo4j.
Right now , I am getting datetime in below format:
I don't think you can do this directly using Neo4j, but if you install the APOC (https://neo4j.com/docs/labs/apoc/current/introduction/#installation) library it has a function which does this, which can you can find here - https://neo4j.com/docs/labs/apoc/current/temporal/temporal-conversions/
So for example:
return apoc.temporal.format(datetime(), "YYYY-MM-dd HH:mm:ss")
Hope that helps.
Thanks a lot and It helped a lot actually!
Can we use this query to set a value to this property while loading the data?
apoc.temporal.format(datetime(), "dd-MM-YYYY HH:mm:ss")
yeh you can use the function anywhere, so you could certainly use it to store a value to a property. I expect more likely you'd want to store a Date value to a property and then use this function to format the data before you display it somewhere
Yes Mark ! It is like this only.