Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-24-2019 05:14 AM
Hello guys!
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:
"2019-09-24T17:43:39.151000000+05:30"
Best Regards
Akshat
09-25-2019 05:07 AM
Hey,
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")
"2019-09-25 12:06:17"
Hope that helps.
Mark
09-25-2019 05:37 AM
Hello Mark,
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")
"25-09-2019 17:43:44"
Thanks
Akshat
10-01-2019 05:32 AM
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
10-03-2019 02:40 AM
Yes Mark ! It is like this only.
All the sessions of the conference are now available online